ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
error.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - 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
11#pragma once
12
13#include <rpp/sources/create.hpp>
14#include <rpp/sources/fwd.hpp>
15#include <rpp/utils/constraints.hpp>
16
17#include <exception>
18
19IMPLEMENTATION_FILE(error_tag);
20
21namespace rpp::observable
22{
36template<constraint::decayed_type Type>
37auto error(const std::exception_ptr& err) requires rpp::details::is_header_included<rpp::details::error_tag, Type>
38{
39 return create<Type>([err](const auto& sub)
40 {
41 sub.on_error(err);
42 });
43}
44} // namespace rpp::observable
auto error(const std::exception_ptr &err)
Creates rpp::specific_observable that emits no items and terminates with an error.
Definition: error.hpp:34