rxjs: Remove tryOrOnError from subscription
Somehow we missed this, but in order to comply with the es-observable spec, and in order not to confuse RxJS 4 users more than we already have, errors thrown in the next handler shouldn’t jump to the error handler:
Observable.of('hi').subscribe(() => {
throw 'haha!';
}, (err) => {
// THIS SHOULD NEVER BE HIT.
});
It should just throw.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 53 (24 by maintainers)
Commits related to this issue
- test(Subscriber): add test for no error propagation Add test to assert that error happening in the next() handler should not propagate to the error() handler. For issue #1135. — committed to staltz/RxJSNext by staltz 8 years ago
- test(Subscriber): add test for no error propagation Add test to assert that error happening in the next() handler should not propagate to the error() handler. For issue #1135. — committed to staltz/RxJSNext by staltz 8 years ago
- test(Subscriber): add test for no error propagation Add test to assert that error happening in the next() handler should not propagate to the error() handler. For issue #1135. — committed to ReactiveX/rxjs by staltz 8 years ago
Why have the same error catching code for two very different sources of error? In
onError
you know you are treating errors that happened in the source Observable. It tells something about the source Observable, for instance, maybe you should add a retry() or a catch(), or maybe something is wrong about the original data source. In atry catch
inside one of the observer callbacks, you know something wrong happened to the consumer/observer and its side effects that it generated. Really, it’s this: