-
Notifications
You must be signed in to change notification settings - Fork 7.6k
2.x: inconsistent error handling in onErrorResumeNext after completion #6571
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
Comments
With operators that are async boundaries themselves, signaling an As for the The fundamental problem though is the API that crashes for getting cancelled/interrupted. These are very common due to the vast amount of blocking APIs that have been created over the decades. One of the solutions is to not let them crash into RxJava. Handling item or resource lifecylce is beyond the scope of RxJava. The operator |
@akarnokd thanks for the fast response. I understand your reasoning, however RxJava makes it is really hard to do a proper central error handling for this sort of API / Resource which is very unfortunate. |
@akarnokd an other thing I was wondering about is, why does |
I'm not sure, I have to check them. |
|
Thanks for checking!
Sorry, I didn't quite understand which fix you mean here? |
Okay, I agree! |
I don't think the error handling can be resolved in 2.x because how drastically the behavior changes. 3.x will be more thorough in this regard. |
Uh oh!
There was an error while loading. Please reload this page.
Tested using RxJava
v2.2.10
Use Case:
We want to handle a known exception that can occur anywhere in a long observable stream using
onErrorResumeNext
.The Exception is thrown due to async behavior: A resource is closed which triggers the a
takeUntil
however due to async operation (observeOn
) in the stream, an operator may still access the closed resource causing the exception.Problem
map
) thetakeUntil
is triggeredDepending on which operators are between the operator that throws the exception and the
onErrorResumeNext
RX behaves differently in step 5, not allowing us to properly handle the Error:doOnNext
,map
,concatMap
and probably most others:onErrorResumeNext
is called and handles the errorswitchMap
: the Exception is completely swallowed, neitheronErrorResumeNext
is called nor anUndeliverableException
is thrown or printed anywhere.flatMap
: AUndeliverableException
is thrown.For us all cases except for the
flatMap
behavior is okay.Example:
Exception Printed with flatMap:
The text was updated successfully, but these errors were encountered: