# std::execution::just_error

From cppreference.com
< cpp‎ | execution

Defined in header `<execution>` |  |
inline constexpr just_error_t just_error{}; struct just_error_t { /*unspecified*/ }; |  | (since C++26) (customization point object)
Call signature |  |
execution::sender auto just_error( auto&& error ); |  | (since C++26)

A sender factory that returns a sender which completes immediately by calling the receiver’s `set_error()`.

Let e be a subexpression represented by an input error which will be injected and returned by the receiver. The expression just_error(e) is expression-equivalent to /*make-sender*/(just_error, /*product-type*/(e))

### Customization point objects

The name `execution::just_error` denotes a customization point object, which is a const function object of a literal `semiregular` class type. The cv-unqualified version of its type is a tag type denoted as `execution::just_error_t`.

All instances of `execution::just_error_t` are equal. The effects of invoking different instances of type `execution::just_error_t` on the same arguments are equivalent, regardless of whether the expression denoting the instance is an lvalue or rvalue, and is const-qualified or not (however, a volatile-qualified instance is not required to be invocable). Thus, `execution::just_error` can be copied freely and its copies can be used interchangeably.

Given a set of types `Args...`, if std::declval <Args>()... meet the requirements for arguments to `execution::just_error` above, `execution::just_error_t` models

- std::invocable <execution::just_error_t, Args...>,
- std::invocable <const execution::just_error_t, Args...>,
- std::invocable <execution::just_error_t&, Args...>, and
- std::invocable <const execution::just_error_t&, Args...>.

Otherwise, no function call operator of `execution::just_error_t` participates in overload resolution.

### Notes

If the provided error is an lvalue reference, a copy is made inside the returned sender and a non-const lvalue reference to the copy is sent to the receiver’s set_error. If the provided value is an rvalue reference, it is moved into the returned sender and an rvalue reference to it is sent to the receiver’s `set_error`.

### Example

| This section is incomplete Reason: no example

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/execution/just_error&oldid=176807"