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

errors do not terminate source unless an observer is provided #1921

Closed
colinfang opened this issue Sep 5, 2016 · 7 comments
Closed

errors do not terminate source unless an observer is provided #1921

colinfang opened this issue Sep 5, 2016 · 7 comments
Labels
bug Confirmed bug

Comments

@colinfang
Copy link

Observable.interval(1000)
  .flatMap(() => this.http.get('abc'))
  .subscribe(
      // x => console.log('Next: ' + x) // Don't terminite without this.
  );

This http request gives an error due to 404. But the stream keeps polling.

However, as soon as I uncomment the commented line in subscribe, it terminates on the first error.

See example here

http://plnkr.co/edit/bQyBvboFJCPyZUEFjraX?p=preview

Why is that?

@jayphelps jayphelps added the bug Confirmed bug label Sep 10, 2016
@jayphelps jayphelps changed the title flatMap doesn't terminate at error. errors do not terminate source unless an observer is provided Sep 10, 2016
@jayphelps
Copy link
Member

Appears this isn't related to flatMap, it's more general than that. If you don't provide an observer to subscribe(observer) then the source does not terminate correctly.

@jayphelps
Copy link
Member

Still digging, but here's my minimal example:

http://jsbin.com/yayave/edit?js,output

So far my best guess is it's related to the internal syncErrorThrowable, whether it's true or false. Not providing an observer it gets the default empty observer which is syncErrorThrowable: false but when you provide your own its syncErrorThrowable: true. This logic is seemingly for optimizing try/catch.

@Blesh this prolly needs your attention since I believe you're the one who knows this part best.

@trxcllnt
Copy link
Member

trxcllnt commented Sep 10, 2016

@jayphelps I'm responsible for syncErrorThrowable, so I'll dig into this one.

@jayphelps
Copy link
Member

@trxcllnt this is all YOUR FAULT!

@trxcllnt
Copy link
Member

@jayphelps I may have authored the code, but syncErrorThrowable is the product of a debate on error handling semantics that I lost, so I'm going to blame @Blesh and @zenparsing :-)

trxcllnt added a commit to trxcllnt/rxjs that referenced this issue Sep 11, 2016
…subscription error calling xhr.abort().

Possibly only an artifact of test utils, but after applying fix for ReactiveX#1921 started getting an error

that xhr.abort() in AjaxObservable's unsubscribe call wasn't a function.
@trxcllnt trxcllnt mentioned this issue Sep 11, 2016
@trxcllnt
Copy link
Member

@jayphelps @colinfang fixed in #1935

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants