[exec.stopped.err]

# 33 Execution control library [[exec]](./#exec)

## 33.9 Senders [[exec.snd]](exec.snd#exec.stopped.err)

### 33.9.12 Sender adaptors [[exec.adapt]](exec.adapt#exec.stopped.err)

#### 33.9.12.15 execution​::​stopped_as_error [exec.stopped.err]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4856)

stopped_as_error maps an input sender's stopped completion operation
into an error completion operation as a custom error type[.](#1.sentence-1)

The result is a sender that never completes with stopped,
reporting cancellation by completing with an error[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4862)

The name stopped_as_error denotes a pipeable sender adaptor object[.](#2.sentence-1)

For some subexpressions sndr and err,
let Sndr be decltype((sndr)) and
let Err be decltype((err))[.](#2.sentence-2)

If the type Sndr does not satisfy [sender](exec.snd.concepts#concept:sender "33.9.3 Sender concepts [exec.snd.concepts]") or
if the type Err does not satisfy [*movable-value*](exec.general#concept:movable-value "33.1 General [exec.general]"),stopped_as_error(sndr, err) is ill-formed[.](#2.sentence-3)

Otherwise, the expression stopped_as_error(sndr, err) is expression-equivalent to:transform_sender(*get-domain-early*(sndr), *make-sender*(stopped_as_error, err, sndr)) except that sndr is only evaluated once[.](#2.sentence-4)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L4877)

Let sndr and env be subexpressions
such that Sndr is decltype((sndr)) andEnv is decltype((env))[.](#3.sentence-1)

If [*sender-for*](exec.snd.concepts#concept:sender-for "33.9.3 Sender concepts [exec.snd.concepts]")<Sndr, stopped_as_error_t> is false,
then the expression stopped_as_error.transform_sender(sndr, env) is ill-formed;
otherwise, it is equivalent to:auto&& [_, err, child] = sndr;using E = decltype(auto(err));return let_stopped( std::forward_like<Sndr>(child), [err = std::forward_like<Sndr>(err)]() mutable noexcept(is_nothrow_move_constructible_v<E>) {return just_error(std::move(err)); });
