23 "Default catch_as_failure only supports void and step_result");
25 static_assert(std::is_void_v<R> || std::is_same_v<R, step_result>);
38template <
typename R,
typename Policy>
41 const std::exception_ptr&
ep)
noexcept {
43 "catch_as_failure(task, policy) requires a noexcept fallback taking std::exception_ptr and returning a compatible result");
45 if constexpr (std::is_void_v<R>) {
46 return std::invoke(policy,
ep);
48 return static_cast<R>(std::invoke(policy,
ep));
62template <
typename PolicyResult>
64 static_assert(std::is_same_v<PolicyResult, step_result>,
65 "Void task catch policy must return step_result");
71 using raw_t = std::remove_cvref_t<R>;
73 if constexpr (std::is_same_v<raw_t, step_result>) {
85 std::is_same_v<std::remove_cvref_t<R>,
step_result> ||
88template <
typename Raw>
90 using raw_t = std::remove_cvref_t<Raw>;
93 "Retry exhaustion fallback is only valid for results that carry step_status");
95 static_cast<void>(
raw);
97 if constexpr (std::is_same_v<raw_t, step_result>) {
100 return raw_t::failure();
104template <
typename Policy,
typename Raw>
106 requires(
const std::remove_cvref_t<Policy>& policy,
Raw&&
raw) {
107 { policy.on_exhausted(std::forward<Raw>(
raw)) }
noexcept
108 -> std::convertible_to<std::remove_cvref_t<Raw>>;
111template <
typename Policy,
typename Raw>
114 return policy.on_exhausted(std::forward<Raw>(
raw));
116 return std::forward<Raw>(
raw);
constexpr bool raw_result_requests_retry(const R &r) noexcept
constexpr bool retry_status_capable_result_v
auto policy_catch_failure_result(Policy &policy, const std::exception_ptr &ep) noexcept
Invokes a fallback policy to produce the exception-path raw result.
constexpr auto default_catch_failure_result() noexcept
Produces the default failure result used by catch_as_failure(task).
constexpr auto retry_exhausted_as_failure(const Raw &raw) noexcept
constexpr auto handle_retry_exhausted(const Policy &policy, Raw &&raw) noexcept
constexpr auto void_task_success_result() noexcept
Produces the success-path raw result for a wrapped void task when a custom fallback policy is install...
constexpr bool is_adapter_descriptor_v
Represents the basic outcome of a task step.
static constexpr step_result failure() noexcept
Creates a failed result.
static constexpr step_result success() noexcept
Creates a successful result.