Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: wrap undeliverable errors #5080

Merged
merged 2 commits into from
Feb 8, 2017

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Feb 7, 2017

This PR adds the UndeliverableException and ProtocolViolationException. The former wraps exceptions that happen beyond the lifecycle of a flow and the latter is added to distinguish validation bugs.

The RxJavaPlugins.onError wraps errors into UndeliverableException unless RxJavaPlugins.isBug() returns true when the Throwable is relayed to the (default) handler.

Having the UndeliverableException should help with understanding the source of a crash and by having its own stack trace, help locating the offending positions (for example, a missed isDisposed() check in a 3rd party library).

@codecov
Copy link

codecov bot commented Feb 7, 2017

Codecov Report

Merging #5080 into 2.x will not impact coverage by -0.02%.

@@             Coverage Diff              @@
##                2.x    #5080      +/-   ##
============================================
- Coverage     95.58%   95.57%   -0.02%     
- Complexity     5537     5552      +15     
============================================
  Files           612      614       +2     
  Lines         39561    39580      +19     
  Branches       5553     5559       +6     
============================================
+ Hits          37816    37827      +11     
- Misses          760      772      +12     
+ Partials        985      981       -4
Impacted Files Coverage Δ Complexity Δ
...activex/internal/disposables/DisposableHelper.java 100% <100%> (ø) 28 <1> (ø)
.../main/java/io/reactivex/plugins/RxJavaPlugins.java 100% <100%> (ø) 146 <7> (+8)
...o/reactivex/exceptions/UndeliverableException.java 100% <100%> (ø) 1 <1> (?)
...vex/internal/subscriptions/SubscriptionHelper.java 100% <100%> (ø) 36 <2> (ø)
...activex/exceptions/ProtocolViolationException.java 100% <100%> (ø) 1 <1> (?)
...ernal/operators/flowable/FlowableFlatMapMaybe.java 89.55% <ø> (-7.97%) 2% <ø> (ø)
...a/io/reactivex/processors/SerializedProcessor.java 91.48% <ø> (-6.39%) 27% <ø> (-1%)
...ava/io/reactivex/processors/BehaviorProcessor.java 86.44% <ø> (-5.15%) 55% <ø> (ø)
...rnal/operators/completable/CompletableTimeout.java 92.3% <ø> (-5.13%) 2% <ø> (ø)
...rnal/subscribers/SinglePostCompleteSubscriber.java 94.87% <ø> (-5.13%) 14% <ø> (-1%)
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66fbf5a...92dc5f2. Read the comment docs.

@@ -0,0 +1,35 @@
/**
* Copyright (c) 2016-present, RxJava Contributors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2017

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All our headers are like this, no current year.

@@ -0,0 +1,35 @@
/**
* Copyright (c) 2016-present, RxJava Contributors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2017

* @return true if the error should pass throug, false if
* it may be wrapped into an UndeliverableException
*/
static boolean isBug(Throwable error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't CompositeException be in here as well? While technically they're always undeliverable, they're very crash-worthy exceptions since they indicate an error while processing an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. A few tests have been reverted from assertUndeliverable to assertError. I've also added an isBug unit test.

@akarnokd akarnokd merged commit 8819cc9 into ReactiveX:2.x Feb 8, 2017
@akarnokd akarnokd deleted the BeyondLifecycleException branch February 8, 2017 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants