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++.
Classes | Namespaces | Macros | Functions
rx-on_error_resume_next.hpp File Reference

If an error occurs, take the result from the Selector and subscribe to that instead. More...

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

Go to the source code of this file.

Classes

struct  rxcpp::member_overload< on_error_resume_next_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::on_error_resume_next (AN &&...an) -> operator_factory< on_error_resume_next_tag, AN... >
 If an error occurs, take the result from the Selector and subscribe to that instead. More...
 
template<class... AN>
auto rxcpp::operators::switch_on_error (AN &&...an) -> operator_factory< on_error_resume_next_tag, AN... >
 If an error occurs, take the result from the Selector and subscribe to that instead. More...
 

Detailed Description

If an error occurs, take the result from the Selector and subscribe to that instead.

Template Parameters
Selectorthe actual type of a function of the form observable<T>(std::exception_ptr)
Parameters
sthe function of the form observable<T>(std::exception_ptr)
Returns
Observable that emits the items from the source observable and switches to a new observable on error.
Sample Code
auto values = rxcpp::observable<>::range(1, 3).
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
on_error_resume_next([](std::exception_ptr ep){
printf("Resuming after: %s\n", rxu::what(ep).c_str());
});
values.
[](int v){printf("OnNext: %d\n", v);},
[](std::exception_ptr ep){
printf("OnError: %s\n", rxu::what(ep).c_str());
},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
Resuming after: Error from source
OnNext: -1
OnCompleted

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP