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

Exception in subscribe's onNext is not rethrown #789

Closed
dvtomas opened this issue Jan 28, 2014 · 3 comments
Closed

Exception in subscribe's onNext is not rethrown #789

dvtomas opened this issue Jan 28, 2014 · 3 comments

Comments

@dvtomas
Copy link

dvtomas commented Jan 28, 2014

import rx.lang.scala.Observable
Observable.items(1, 2, 3).subscribe(next  throw new RuntimeException("Bang!"))

I'm still trying to grasp all the nuances of the Rx Contract, but according to various sources (for one, http://social.msdn.microsoft.com/Forums/en-US/6ea06e08-6d26-49b4-a3fa-276d1efef780/what-if-an-exception-is-thrown-by-the-observer-in-onnext?forum=rx), I'd expect this code snippet to throw the Bang exception, but it does (as of Rx 0.16.1) not. However, such issue seems too basic to me to go unnoticed, so I guess there is some reason for such behavior. Can someone elaborate, please?

Thank you,
Tomáš Dvořák

@zsxwing
Copy link
Member

zsxwing commented Jan 28, 2014

Your Bang exception should be sent to onError method. But you do not pass the onError function. So an OnErrorNotImplementedException should be thrown. However, as the issue #771, the OnErrorNotImplementedException will be swallowed. Once the issue is fixed, you will observe OnErrorNotImplementedException.

@benjchristensen
Copy link
Member

Dealing with in pull request #839

benjchristensen added a commit to benjchristensen/RxJava that referenced this issue Feb 8, 2014
- 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.
@benjchristensen
Copy link
Member

Should be fixed in #839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants