void set_error()

in include/unifex/finally.hpp [415:447]


      void set_error(Error&& error) && noexcept {
        static_assert(
            std::is_nothrow_constructible_v<std::decay_t<Error>, Error>);

        auto* const op = op_;
        unifex::activate_union_member<std::decay_t<Error>>(
            op->error_, static_cast<Error&&>(error));

        unifex::deactivate_union_member(op->sourceOp_);

        UNIFEX_TRY {
          using error_receiver_t = error_receiver<
              SourceSender,
              CompletionSender,
              Receiver,
              Error>;
          using completion_error_op_t =
            connect_result_t<CompletionSender, error_receiver_t>;
          auto& completionOp =
              unifex::activate_union_member_with<completion_error_op_t>(
                  op->completionErrorOp_,
                  [&] {
                    return unifex::connect(
                        static_cast<CompletionSender&&>(op->completionSender_),
                        error_receiver_t{op});
                  });
          unifex::start(completionOp);
        } UNIFEX_CATCH (...) {
          unifex::deactivate_union_member<std::decay_t<Error>>(op->error_);
          unifex::set_error(
              static_cast<Receiver&&>(op->receiver_), std::current_exception());
        }
      }