ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
error.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2023 - present.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// https://www.boost.org/LICENSE_1_0.txt)
7//
8// Project home: https://github.com/victimsnino/ReactivePlusPlus
9
10#pragma once
11
12#include <rpp/sources/fwd.hpp>
13
14#include <rpp/observables/observable.hpp>
15
16namespace rpp::details
17{
18 template<constraint::decayed_type Type>
20 {
21 using value_type = Type;
23
24 std::exception_ptr err{};
25
26 void subscribe(const auto& obs) const { obs.on_error(err); }
27 };
28} // namespace rpp::details
29
30namespace rpp
31{
32 template<constraint::decayed_type Type>
34} // namespace rpp
35
36namespace rpp::source
37{
51 template<constraint::decayed_type Type>
52 auto error(std::exception_ptr err)
53 {
54 return error_observable<Type>{std::move(err)};
55 }
56} // namespace rpp::source
Base class for any observable used in RPP. It handles core callbacks of observable.
Definition observable.hpp:38
auto error(std::exception_ptr err)
Creates rpp::observable that emits no items and terminates with an error.
Definition error.hpp:49
Definition error.hpp:20
Definition disposables_strategy.hpp:29