-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
fix #5468: eager hooks onError call #5470
fix #5468: eager hooks onError call #5470
Conversation
Move the call to RxJavaHooks into the catch block, so we only report it if the underlying subscriber throws in its onError method. This brings the behaviour in line with that of SafeSubscriber, which only call Hooks.onError inside the catch
Not sure if this change warrants a unit test, but I am happy to add them if you think it is necessary |
@@ -54,7 +54,6 @@ public void onCompleted() { | |||
|
|||
@Override | |||
public void onError(Throwable e) { | |||
RxJavaHooks.onError(e); | |||
if (done) { | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have moved it here.
@@ -63,6 +62,7 @@ public void onError(Throwable e) { | |||
actual.onError(e); | |||
} catch (Throwable ex) { | |||
Exceptions.throwIfFatal(ex); | |||
RxJavaHooks.onError(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akarnokd so this should be in if(done) only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Codecov Report
@@ Coverage Diff @@
## 1.x #5470 +/- ##
===========================================
- Coverage 84.41% 84.3% -0.11%
+ Complexity 2889 2886 -3
===========================================
Files 291 291
Lines 18130 18130
Branches 2479 2478 -1
===========================================
- Hits 15304 15285 -19
- Misses 1961 1973 +12
- Partials 865 872 +7
Continue to review full report at Codecov.
|
Move the call to RxJavaHooks into the catch block, so we only report and it if the underlying subscriber throws in its onError method.
This brings its behaviour in line with that of SafeSubscriber