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

Most upvoted comments

@trxcllnt the point is there should be one place to you handle uncaught errors (the onError handler) because you shouldn’t be forced to repeat the same code in two places (inside onNext and onError).

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 a try 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:

@blesh It means you don’t know if your producer erred or if your consumer erred.