ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
Error Handling Operators

Operators that help to recover from error notifications from an Observable. More...

Functions

template<typename Selector>
requires rpp::constraint::observable<std::invoke_result_t<Selector, std::exception_ptr>>
auto rpp::operators::on_error_resume_next (Selector &&selector)
 If an error occurs, take the result from the Selector and subscribe to that instead.
 
auto rpp::operators::retry (size_t count)
 The retry operator attempts to resubscribe to the observable when an error occurs, up to the specified number of retries.
 
auto rpp::operators::retry ()
 The infinite retry operator continuously attempts to resubscribe to the observable upon error, without a retry limit.
 

Detailed Description

Operators that help to recover from error notifications from an Observable.

See also
https://reactivex.io/documentation/operators.html#error

Function Documentation

◆ on_error_resume_next()

template<typename Selector>
requires rpp::constraint::observable<std::invoke_result_t<Selector, std::exception_ptr>>
auto rpp::operators::on_error_resume_next ( Selector && selector)

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

Parameters
selectorcallable taking a std::exception_ptr and returning observable to continue on
Note
#include <rpp/operators/on_error_resume_next.hpp>
See also
https://reactivex.io/documentation/operators/catch.html

◆ retry() [1/2]

auto rpp::operators::retry ( )
inline

The infinite retry operator continuously attempts to resubscribe to the observable upon error, without a retry limit.

Note
#include <rpp/operators/retry.hpp>
Examples:
| rpp::operators::subscribe([](int v) { std::cout << v << " "; },
[](const std::exception_ptr&) { std::cout << "error" << std::endl; },
[]() { std::cout << "completed" << std::endl; });
// Output: 1 2 3 1 2 3 1 2 3 1 completed
See also
https://reactivex.io/documentation/operators/retry.html

◆ retry() [2/2]

auto rpp::operators::retry ( size_t count)
inline

The retry operator attempts to resubscribe to the observable when an error occurs, up to the specified number of retries.

Parameters
countis the number of retries
Note
#include <rpp/operators/retry.hpp>
Examples:
| rpp::operators::subscribe([](int v) { std::cout << v << " "; },
[](const std::exception_ptr&) { std::cout << "error" << std::endl; },
[]() { std::cout << "completed" << std::endl; });
// Output: 1 2 3 1 2 3 1 2 3 error
See also
https://reactivex.io/documentation/operators/retry.html