diff options
author | Igor Murashkin <iam@google.com> | 2018-03-22 14:28:07 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2018-08-09 17:04:15 -0700 |
commit | da5396314d890d66fcd38d6cc5c61ab6d37b476c (patch) | |
tree | 10110cbe185cfb37743a75e941fe149e26171134 /Rx/v2/src/rxcpp/operators | |
parent | 122c10b47aa429775a58abe86b4240bebc7da4a1 (diff) | |
download | RxCpp-da5396314d890d66fcd38d6cc5c61ab6d37b476c.tar.gz |
Rx: Add support for compiling code without exceptions (-fno-exceptions)
std::exception_ptr usage is replaced with rxcpp::util::error_ptr
which will typedef to std::exception_ptr when exceptions are enabled.
When exceptions are disabled this will typedef to an internal error
type that can retain the "what" error message.
Additionally std::current_exception() and similar usages are replaced
with rxu::current_exception which uses error_ptr instead.
Lastly all try/catch/throw keywords are replaced with either
RXCPP_TRY, RXCPP_CATCH, rxu::throw_exception or similar.
Note that try/catch/throw keywords cause a compilation error with
-fno-exceptions. Trying to access most of the std::*exception* functions
will call std::terminate at runtime.
Tests using exceptions must be disabled by passing --nothrow to the
check2 test runner.
Change-Id: I0b95ae2e323653a17c3b733d165ecf87a014c315
Diffstat (limited to 'Rx/v2/src/rxcpp/operators')
52 files changed, 86 insertions, 85 deletions
diff --git a/Rx/v2/src/rxcpp/operators/rx-all.hpp b/Rx/v2/src/rxcpp/operators/rx-all.hpp index 65bec46..a0f6a3e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-all.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-all.hpp @@ -83,7 +83,7 @@ struct all dest.on_completed(); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-amb.hpp b/Rx/v2/src/rxcpp/operators/rx-amb.hpp index 595dc4d..56bfbe9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-amb.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-amb.hpp @@ -183,7 +183,7 @@ struct amb } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -196,7 +196,7 @@ struct amb selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-any.hpp b/Rx/v2/src/rxcpp/operators/rx-any.hpp index 4488375..19fca6e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-any.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-any.hpp @@ -90,7 +90,7 @@ struct any dest.on_completed(); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp index a4dea3b..79eb30e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -96,7 +96,7 @@ struct buffer_count chunks.pop_front(); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index 7e54eb8..aa94f7b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -197,7 +197,7 @@ struct buffer_with_time } localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index 346a6ef..6d4b9a4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -179,7 +179,7 @@ struct buffer_with_time_or_count } localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 0f94fde..06ff3d1 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -173,7 +173,7 @@ struct combine_latest : public operator_base<rxu::value_type_t<combine_latest_tr } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 57b42fa..457b9cf 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -143,7 +143,7 @@ struct concat state->out.on_next(ct); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -207,7 +207,7 @@ struct concat } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index edcdb26..546c1eb 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -183,7 +183,7 @@ struct concat_map state->out.on_next(std::move(selectedResult)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -246,7 +246,7 @@ struct concat_map } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-debounce.hpp b/Rx/v2/src/rxcpp/operators/rx-debounce.hpp index 5f56ff9..6fbedd7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-debounce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-debounce.hpp @@ -158,7 +158,7 @@ struct debounce localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&) { localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-delay.hpp b/Rx/v2/src/rxcpp/operators/rx-delay.hpp index 19bbed5..5986f79 100644 --- a/Rx/v2/src/rxcpp/operators/rx-delay.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-delay.hpp @@ -131,7 +131,7 @@ struct delay localState->worker.schedule(localState->worker.now() + localState->period, selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct.hpp index c3ca086..c90ebdb 100644 --- a/Rx/v2/src/rxcpp/operators/rx-distinct.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-distinct.hpp @@ -61,7 +61,7 @@ struct distinct dest.on_next(v); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp index 7d8ef5a..3702185 100644 --- a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp @@ -74,7 +74,7 @@ struct distinct_until_changed dest.on_next(v); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-element_at.hpp b/Rx/v2/src/rxcpp/operators/rx-element_at.hpp index 5cbe6dc..1d773ac 100644 --- a/Rx/v2/src/rxcpp/operators/rx-element_at.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-element_at.hpp @@ -77,12 +77,12 @@ struct element_at { dest.on_completed(); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { if(current <= this->index) { - dest.on_error(std::make_exception_ptr(std::range_error("index is out of bounds"))); + dest.on_error(rxu::make_error_ptr(std::range_error("index is out of bounds"))); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index 86ce649..3a622bb 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -79,7 +79,7 @@ struct filter dest.on_next(std::forward<Value>(v)); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-finally.hpp b/Rx/v2/src/rxcpp/operators/rx-finally.hpp index 4e4416c..d6f5487 100644 --- a/Rx/v2/src/rxcpp/operators/rx-finally.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-finally.hpp @@ -70,7 +70,7 @@ struct finally void on_next(source_value_type v) const { dest.on_next(v); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 5b68b37..eb76198 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -198,7 +198,7 @@ struct flat_map state->out.on_next(std::move(selectedResult)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -213,7 +213,7 @@ struct flat_map selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp index 4eadbab..f702fba 100644 --- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -195,7 +195,7 @@ struct group_by auto selectedKey = on_exception( [&](){ return this->keySelector(v);}, - [this](std::exception_ptr e){on_error(e);}); + [this](rxu::error_ptr e){on_error(e);}); if (selectedKey.empty()) { return; } @@ -211,13 +211,13 @@ struct group_by auto selectedMarble = on_exception( [&](){ return this->marbleSelector(v);}, - [this](std::exception_ptr e){on_error(e);}); + [this](rxu::error_ptr e){on_error(e);}); if (selectedMarble.empty()) { return; } g->second.on_next(std::move(selectedMarble.get())); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { for(auto& g : state->groups) { g.second.on_error(e); } diff --git a/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp b/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp index 82fbe95..00b10a6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp @@ -56,7 +56,7 @@ struct ignore_elements { // no-op; ignore element } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index a670d88..7570376 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -77,7 +77,7 @@ struct map } dest.on_next(std::move(selected.get())); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index ad8f7d0..cc1ea77 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -173,7 +173,7 @@ struct merge state->out.on_next(std::move(ct)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -188,7 +188,7 @@ struct merge selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp b/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp index 43fdee3..51f8867 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp @@ -167,10 +167,10 @@ struct merge_delay_error state->out.on_next(std::move(ct)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if(--state->pendingCompletions == 0) { state->out.on_error( - std::make_exception_ptr(std::move(state->exception.add(e)))); + rxu::make_error_ptr(std::move(state->exception.add(e)))); } else { state->exception.add(e); } @@ -180,7 +180,7 @@ struct merge_delay_error if (--state->pendingCompletions == 0) { if(!state->exception.empty()) { state->out.on_error( - std::make_exception_ptr(std::move(state->exception))); + rxu::make_error_ptr(std::move(state->exception))); } else { state->out.on_completed(); } @@ -192,10 +192,10 @@ struct merge_delay_error selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if(--state->pendingCompletions == 0) { state->out.on_error( - std::make_exception_ptr(std::move(state->exception.add(e)))); + rxu::make_error_ptr(std::move(state->exception.add(e)))); } else { state->exception.add(e); } @@ -205,7 +205,7 @@ struct merge_delay_error if (--state->pendingCompletions == 0) { if(!state->exception.empty()) { state->out.on_error( - std::make_exception_ptr(std::move(state->exception))); + rxu::make_error_ptr(std::move(state->exception))); } else { state->out.on_completed(); } diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 99de4c3..c1d59a9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -127,7 +127,7 @@ struct observe_on auto drain = [keepAlive, this](const rxsc::schedulable& self){ using std::swap; - try { + RXCPP_TRY { for (;;) { if (drain_queue.empty() || !destination.is_subscribed()) { std::unique_lock<std::mutex> guard(lock); @@ -151,8 +151,9 @@ struct observe_on self(); if (lifetime.is_subscribed()) break; } - } catch(...) { - destination.on_error(std::current_exception()); + } + RXCPP_CATCH(...) { + destination.on_error(rxu::current_exception()); std::unique_lock<std::mutex> guard(lock); finish(guard, mode::Errored); } @@ -188,7 +189,7 @@ struct observe_on state->fill_queue.push_back(notification_type::on_next(std::move(v))); state->ensure_processing(guard); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { std::unique_lock<std::mutex> guard(state->lock); if (state->current == mode::Errored || state->current == mode::Disposed) { return; } state->fill_queue.push_back(notification_type::on_error(e)); diff --git a/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp b/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp index 4ebee38..bc9beba 100644 --- a/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp @@ -6,9 +6,9 @@ \brief If an error occurs, take the result from the Selector and subscribe to that instead. - \tparam Selector the actual type of a function of the form `observable<T>(std::exception_ptr)` + \tparam Selector the actual type of a function of the form `observable<T>(rxu::error_ptr)` - \param s the function of the form `observable<T>(std::exception_ptr)` + \param s the function of the form `observable<T>(rxu::error_ptr)` \return Observable that emits the items from the source observable and switches to a new observable on error. @@ -44,7 +44,7 @@ struct on_error_resume_next { typedef rxu::decay_t<T> value_type; typedef rxu::decay_t<Selector> select_type; - typedef decltype((*(select_type*)nullptr)(std::exception_ptr())) fallback_type; + typedef decltype((*(select_type*)nullptr)(rxu::error_ptr())) fallback_type; select_type selector; on_error_resume_next(select_type s) @@ -58,7 +58,7 @@ struct on_error_resume_next typedef on_error_resume_next_observer<Subscriber> this_type; typedef rxu::decay_t<T> value_type; typedef rxu::decay_t<Selector> select_type; - typedef decltype((*(select_type*)nullptr)(std::exception_ptr())) fallback_type; + typedef decltype((*(select_type*)nullptr)(rxu::error_ptr())) fallback_type; typedef rxu::decay_t<Subscriber> dest_type; typedef observer<T, this_type> observer_type; dest_type dest; @@ -75,7 +75,7 @@ struct on_error_resume_next void on_next(value_type v) const { dest.on_next(std::move(v)); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto selected = on_exception( [&](){ return this->selector(std::move(e));}, diff --git a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp index 584a6bf..411cf27 100644 --- a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp @@ -67,7 +67,7 @@ struct pairwise dest.on_next(std::make_tuple(remembered.get(), v)); remembered.reset(v); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 7fc9d08..e5dc819 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -166,7 +166,7 @@ struct reduce : public operator_base<rxu::value_type_t<reduce_traits<T, Observab state->current = std::move(next); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed @@ -244,7 +244,7 @@ struct average { } return avg; } - throw rxcpp::empty_error("average() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("average() requires a stream with at least one value")); } }; @@ -264,7 +264,7 @@ struct sum { } T operator()(seed_type a) const { if (a.empty()) - throw rxcpp::empty_error("sum() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("sum() requires a stream with at least one value")); return *a; } }; @@ -283,7 +283,7 @@ struct max { } T operator()(seed_type a) { if (a.empty()) - throw rxcpp::empty_error("max() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("max() requires a stream with at least one value")); return *a; } }; @@ -302,7 +302,7 @@ struct min { } T operator()(seed_type a) { if (a.empty()) - throw rxcpp::empty_error("min() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("min() requires a stream with at least one value")); return *a; } }; @@ -320,7 +320,7 @@ struct first { } T operator()(seed_type a) { if (a.empty()) { - throw rxcpp::empty_error("first() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("first() requires a stream with at least one value")); } return *a; } @@ -339,7 +339,7 @@ struct last { } T operator()(seed_type a) { if (a.empty()) { - throw rxcpp::empty_error("last() requires a stream with at least one value"); + rxu::throw_exception(rxcpp::empty_error("last() requires a stream with at least one value")); } return *a; } diff --git a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp index 97ba197..3b9ac89 100644 --- a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp @@ -47,7 +47,7 @@ using repeat_invalid_t = typename repeat_invalid<AN...>::type; namespace repeat { struct event_handlers { template <typename State> - static inline void on_error(State& state, std::exception_ptr& e) { + static inline void on_error(State& state, rxu::error_ptr& e) { state->out.on_error(e); } diff --git a/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp b/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp index 373d9b3..30a71fe 100644 --- a/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp @@ -42,7 +42,7 @@ namespace rxcpp { state->out.on_next(t); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { EventHandlers::on_error(state, e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-retry.hpp b/Rx/v2/src/rxcpp/operators/rx-retry.hpp index 3cee7d3..63e5c27 100644 --- a/Rx/v2/src/rxcpp/operators/rx-retry.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-retry.hpp @@ -43,7 +43,7 @@ using retry_invalid_t = typename retry_invalid<AN...>::type; namespace retry { struct event_handlers { template <typename State> - static inline void on_error(State& state, std::exception_ptr& e) { + static inline void on_error(State& state, rxu::error_ptr& e) { state->update(); // Use specialized predicate for finite/infinte case if (state->completed_predicate()) { diff --git a/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp b/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp index fe1caa2..f50cbe4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp @@ -150,7 +150,7 @@ struct sample_with_time localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&) { localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp index b03be30..73bcd87 100644 --- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -90,7 +90,7 @@ struct scan : public operator_base<rxu::decay_t<Seed>> state->out.on_next(state->result); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp b/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp index 06253b4..3350e44 100644 --- a/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp @@ -161,7 +161,7 @@ struct sequence_equal : public operator_base<bool> check_equal(); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed @@ -189,7 +189,7 @@ struct sequence_equal : public operator_base<bool> check_equal(); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp index c7f6c11..b77c4da 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -109,7 +109,7 @@ struct skip : public operator_base<T> } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->mode_value = mode::errored; state->out.on_error(e); }, diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp index 6641bd8..9594715 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp @@ -103,7 +103,7 @@ struct skip_last : public operator_base<T> } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp index 02a2424..4df6671 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp @@ -139,7 +139,7 @@ struct skip_until : public operator_base<T> state->trigger_lifetime.unsubscribe(); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if (state->mode_value != mode::skipping) { return; } @@ -174,7 +174,7 @@ struct skip_until : public operator_base<T> state->out.on_next(t); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if (state->mode_value > mode::triggered) { return; } diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp index fdd06b6..643d867 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp @@ -75,7 +75,7 @@ struct skip_while dest.on_next(v); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp index b9bab52..8d3e57e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp @@ -76,7 +76,7 @@ struct switch_if_empty is_empty = false; dest.on_next(std::move(v)); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(std::move(e)); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index b18963a..4572121 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -155,7 +155,7 @@ struct switch_on_next state->out.on_next(std::move(ct)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, //on_completed @@ -171,7 +171,7 @@ struct switch_on_next selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index 054c136..1e4da4d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -112,7 +112,7 @@ struct take : public operator_base<T> } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->mode_value = mode::errored; state->out.on_error(e); }, diff --git a/Rx/v2/src/rxcpp/operators/rx-take_last.hpp b/Rx/v2/src/rxcpp/operators/rx-take_last.hpp index d59b355..12e28b6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_last.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_last.hpp @@ -100,7 +100,7 @@ struct take_last : public operator_base<T> } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 29aaf88..3fd9b71 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -147,7 +147,7 @@ struct take_until : public operator_base<T> state->out.on_completed(); }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if (state->mode_value != mode::taking) {return;} state->mode_value = mode::errored; state->out.on_error(e); @@ -179,7 +179,7 @@ struct take_until : public operator_base<T> } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { if (state->mode_value > mode::clear) {return;} state->mode_value = mode::errored; state->out.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-take_while.hpp b/Rx/v2/src/rxcpp/operators/rx-take_while.hpp index de1d57d..85630e7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_while.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_while.hpp @@ -73,7 +73,7 @@ struct take_while dest.on_completed(); } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-tap.hpp b/Rx/v2/src/rxcpp/operators/rx-tap.hpp index 51bfb2f..550163a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-tap.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-tap.hpp @@ -92,7 +92,7 @@ struct tap out.on_next(v); dest.on_next(v); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { out.on_error(e); dest.on_error(e); } diff --git a/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp b/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp index 181c066..1a4c9a5 100644 --- a/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp @@ -84,7 +84,7 @@ struct time_interval dest.on_next(now - last); last = now; } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-timeout.hpp b/Rx/v2/src/rxcpp/operators/rx-timeout.hpp index 841df12..d100fa4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-timeout.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-timeout.hpp @@ -147,7 +147,7 @@ struct timeout if(id != state->index) return; - state->dest.on_error(std::make_exception_ptr(rxcpp::timeout_error("timeout has occurred"))); + state->dest.on_error(rxu::make_error_ptr(rxcpp::timeout_error("timeout has occurred"))); }; auto selectedProduce = on_exception( @@ -178,7 +178,7 @@ struct timeout localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&) { localState->dest.on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp b/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp index d1a11bf..923cf5d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp @@ -78,7 +78,7 @@ struct timestamp void on_next(source_value_type v) const { dest.on_next(std::make_pair(v, coord.now())); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { dest.on_error(e); } void on_completed() const { diff --git a/Rx/v2/src/rxcpp/operators/rx-window.hpp b/Rx/v2/src/rxcpp/operators/rx-window.hpp index e5d2c6f..e033a84 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window.hpp @@ -103,7 +103,7 @@ struct window } } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { for (auto s : subj) { s.get_subscriber().on_error(e); } diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index 17d4dd2..57f7572 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -195,7 +195,7 @@ struct window_with_time localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ for (auto s : localState->subj) { diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index 39c64ad..9375737 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -183,7 +183,7 @@ struct window_with_time_or_count localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ localState->subj.get_subscriber().on_error(e); diff --git a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp b/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp index c17d4bc..b9f119a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp @@ -176,7 +176,7 @@ struct window_toggle innercs.unsubscribe(); }, // on_error - [localState](std::exception_ptr e) { + [localState](rxu::error_ptr e) { localState->dest.on_error(e); }, // on_completed @@ -186,7 +186,7 @@ struct window_toggle source.subscribe(std::move(selectedSink)); }, // on_error - [localState](std::exception_ptr e) { + [localState](rxu::error_ptr e) { localState->dest.on_error(e); }, // on_completed @@ -218,7 +218,7 @@ struct window_toggle localState->worker.schedule(selectedWork.get()); } - void on_error(std::exception_ptr e) const { + void on_error(rxu::error_ptr e) const { auto localState = state; auto work = [e, localState](const rxsc::schedulable&){ for (auto s : localState->subj) { diff --git a/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp b/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp index febba99..616e5d8 100644 --- a/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp @@ -173,7 +173,7 @@ struct with_latest_from : public operator_base<rxu::value_type_t<with_latest_fro } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp index 90efe07..b8169fd 100644 --- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -203,7 +203,7 @@ struct zip : public operator_base<rxu::value_type_t<zip_traits<Coordination, Sel } }, // on_error - [state](std::exception_ptr e) { + [state](rxu::error_ptr e) { state->out.on_error(e); }, // on_completed |