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< std::exception_ptr, rxu::decay_t< E >>::value, detail::throw_ptr_tag, detail::throw_instance_tag >::type(), std::move(e), identity_immediate()))
 Returns an observable that sends no items to observer and immediately generates an error, on the specified scheduler. More...
 
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< std::exception_ptr, rxu::decay_t< E >>::value, detail::throw_ptr_tag, detail::throw_instance_tag >::type(), std::move(e), std::move(cn)))
 Returns an observable that sends no items to observer and immediately generates an error, on the specified scheduler. More...
 

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
auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"));
values.
[](int v){printf("OnNext: %d\n", v);},
[](std::exception_ptr ep){
try {std::rethrow_exception(ep);}
catch (const std::exception& ex) {
printf("OnError: %s\n", ex.what());
}
},
[](){printf("OnCompleted\n");});
OnError: Error from source
Sample Code
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);},
[](std::exception_ptr ep){
try {std::rethrow_exception(ep);}
catch (const std::exception& ex) {
printf("OnError: %s\n", ex.what());
}
},
[](){printf("OnCompleted\n");});
OnError: Error from source

Macro Definition Documentation

#define RXCPP_SOURCES_RX_ERROR_HPP