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... >
 
template<class... AN>
auto rxcpp::operators::switch_on_error (AN &&... an) -> operator_factory< on_error_resume_next_tag, AN... >
 

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>(rxu::error_ptr)
Parameters
sthe function of the form observable<T>(rxu::error_ptr)
Returns
Observable that emits the items from the source observable and switches to a new observable on error.
Sample Code\n
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

◆ RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP

#define RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP
rxcpp::operators::concat
auto concat(AN &&... an) -> operator_factory< concat_tag, AN... >
Definition: rx-concat.hpp:235
rxcpp::operators::on_error_resume_next
auto on_error_resume_next(AN &&... an) -> operator_factory< on_error_resume_next_tag, AN... >
Definition: rx-on_error_resume_next.hpp:110
rxcpp::sources::range
auto range(T first=0, T last=std::numeric_limits< T >::max(), std::ptrdiff_t step=1) -> observable< T, detail::range< T, identity_one_worker >>
Definition: rx-range.hpp:119
cpplinq::from
linq_driver< iter_cursor< typename util::container_traits< TContainer >::iterator > > from(TContainer &c)
Definition: linq.hpp:556
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::observable
a source of values. subscribe or use one of the operator methods that return a new observable,...
Definition: rx-observable.hpp:478
rxcpp::sources::just
auto just(Value0 v0) -> typename std::enable_if<!is_coordination< Value0 >::value, decltype(iterate(*(std::array< Value0, 1 > *) nullptr, identity_immediate()))>::type
Definition: rx-iterate.hpp:267