RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Namespaces | Macros | Functions
rx-error.hpp File Reference

Returns an observable that sends no items to observer and immediately generates an error, on the specified scheduler. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-error.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 rxcpp
 
 rxcpp::sources
 

Macros

#define RXCPP_SOURCES_RX_ERROR_HPP
 

Functions

template<class T , class E >
auto rxcpp::sources::error (E e) -> decltype(detail::make_error< T >(typename std::conditional< std::is_same< rxu::error_ptr, rxu::decay_t< E >>::value, detail::throw_ptr_tag, detail::throw_instance_tag >::type(), std::move(e), identity_immediate()))
 
template<class T , class E , class Coordination >
auto rxcpp::sources::error (E e, Coordination cn) -> decltype(detail::make_error< T >(typename std::conditional< std::is_same< rxu::error_ptr, rxu::decay_t< E >>::value, detail::throw_ptr_tag, detail::throw_instance_tag >::type(), std::move(e), std::move(cn)))
 

Detailed Description

Returns an observable that sends no items to observer and immediately generates an error, on the specified scheduler.

Template Parameters
Tthe type of (not) emitted items
Exceptionthe type of the error
Coordinationthe type of the scheduler (optional)
Parameters
ethe error to be passed to observers
cnthe scheduler to use for scheduling the items (optional)
Returns
Observable that sends no items to observer and immediately generates an error.
Sample Code\n
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"));
values.
[](int v){printf("OnNext: %d\n", v);},
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
},
[](){printf("OnCompleted\n");});
OnError: Error from source
Sample Code\n
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"), rxcpp::observe_on_event_loop());
values.
[](int v){printf("OnNext: %d\n", v);},
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
},
[](){printf("OnCompleted\n");});
OnError: Error from source

Macro Definition Documentation

◆ RXCPP_SOURCES_RX_ERROR_HPP

#define RXCPP_SOURCES_RX_ERROR_HPP
rxcpp::util::error_ptr
std::shared_ptr< util::detail::error_base > error_ptr
Definition: rx-util.hpp:874
cpplinq::from
linq_driver< iter_cursor< typename util::container_traits< TContainer >::iterator > > from(TContainer &c)
Definition: linq.hpp:556
rxcpp::operators::as_blocking
auto as_blocking() -> detail::blocking_factory
Definition: rx-subscribe.hpp:144
rxcpp::operators::subscribe
auto subscribe(ArgN &&... an) -> detail::subscribe_factory< decltype(make_subscriber< T >(std::forward< ArgN >(an)...))>
Definition: rx-subscribe.hpp:87
rxcpp::util::what
std::string what(std::exception_ptr ep)
Definition: rx-util.hpp:544
rxcpp::observe_on_event_loop
observe_on_one_worker observe_on_event_loop()
Definition: rx-observe_on.hpp:323
rxcpp::observable
a source of values. subscribe or use one of the operator methods that return a new observable,...
Definition: rx-observable.hpp:478