-
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
Error Handling: OnErrorNotImplemented and java.lang.Error #839
Error Handling: OnErrorNotImplemented and java.lang.Error #839
Conversation
This represents a possible approach to handling For The reason for it not being obvious to throw is that by throwing on a background thread instead of sending via Any advice or insight on what is considered to be the right approach for everything else? |
- ReactiveX#748 (comment) - ReactiveX#771 - ReactiveX#789 - SynchronizedObserver is for synchronization, not error handling or contract enforcements, that's the job of SafeSubscriber - Removed some unit tests that were asserting unsubscribe behavior that relied on SynchronizedObserver. They were testing something they are not responsible for.
After thinking about it further I decided I didn't like my previous approach and have replaced it with this one that is more generic and doesn't make any specific operators do anything special. I found the issue was the This resulted in me doing 3 specific changes:
public static void throwIfFatal(Throwable t) {
if (t instanceof OnErrorNotImplementedException) {
throw (OnErrorNotImplementedException) t;
}
// values here derived from https://github.com/Netflix/RxJava/issues/748#issuecomment-32471495
else if (t instanceof StackOverflowError) {
throw (StackOverflowError) t;
} else if (t instanceof VirtualMachineError) {
throw (VirtualMachineError) t;
} else if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
} else if (t instanceof LinkageError) {
throw (LinkageError) t;
}
}
public void onError(Throwable e) {
// we handle here instead of another method so we don't add stacks to the frame
// which can prevent it from being able to handle StackOverflow
Exceptions.throwIfFatal(e);
if (isFinished.compareAndSet(false, true)) {
_onError(e);
}
} These changes appear to have resolved the |
@@ -269,33 +269,6 @@ public void testMergeList() { | |||
} | |||
|
|||
@Test | |||
public void testUnSubscribe() { |
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.
I removed this because it was relying on SynchronizedObserver
behavior related to unsubscribe
. This operator should not concern itself with unsubscribe
from what I can tell. The SafeSubscriber
on a full chain will handle this.
Local build is passing ... merging.
|
Error Handling: OnErrorNotImplemented and java.lang.Error
RxJava-pull-requests #761 SUCCESS |
Special Handling of java.lang.Error and OnErrorNotImplemented