-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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 thrown by rxjs observer not always sent to ErrorHandler.handleError #14316
Comments
That's what I said I tried to do:
Here's as far as I got: http://plnkr.co/edit/ldm5hGVjnvacRFpkIRXv?p=preview It seems the ES2015 import's that I've added for the Rxjs modules are not correct. Do you have an example plunker that showcases using Rxjs scheduler's with angular? Thanks |
OK so I have got the plunker working with the correct imports: http://plnkr.co/edit/ldm5hGVjnvacRFpkIRXv?p=preview And the problem is not reproducible in this. To try and cut the problem space down, I'll create another git repo with a minimum angular seed project generated by the angular-cli with the same exact same versions of angular as the plunker (2.4.6 vs 2.4.1). If this reproduces the problem, then there is going to be more material to work on. |
I've reproduced the problem in a new angular seed project generated by the latest vs of angular-cli (1.0.0-beta.30). See https://github.com/christianacca/rxjs-err-async-pipe Note: the versions of the dependencies in this new project are identical to the plunker version that does work. So it appears a problem with Webpack build (via the cli) of angular and it's rxjs dependency. Reproducing problemFor convenience here is the steps to reproduce the problem with this new project:
Notice that the error thrown by the map operator is logged to the console, but not to sent to Remove |
@christianacca can you pls update the first post and remove unnecessary comments? A lot of different links, it's hard to understand what actually the problem is. Thx. |
I've updated my original post... |
this is how error handler receives errors. Looks like it's zonejs issue. |
Probably will be fixed here ReactiveX/rxjs#2266 There's nothing we can do about it inside angular |
Yeah that was my guess. |
Although if this was the problem, why would the plunker example with the same code work? |
…ar#15077) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
…ar#15077) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
…ar#15077) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
… (#15208) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes #14949 Closes #15182 Closes #14316
…ar#15077) (angular#15208) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
Unfortunately this issue is not closed by PR #15208 - please can you therefore reopen. I have tested against angular 4.1.0 and still see the exact same behaviour as I originally reported. To reproduce with angular 4.1.0 please follow the steps outlined here: #14316 (comment) |
More information:
|
FYI, the problem can be reproduced in angular 4.3.2 + zone.js 0.8.16. This is surprising given that this version of zone.js lands angular/zone.js#843 that was hoping to resolve this problem... Notes:
|
…ar#15077) (angular#15208) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
@ccrowhurstram , thank you for posting the issue, current angular/zone.js#843 patch doesn't fully fix your issue, I have made a new PR (angular/zone.js#884) to fix this one, I have test my idea and it should work. |
Excellent @JiaLiPassion. Thanks for digging into this - saves me from having to spam this issue with each angular release ;-) |
@ccrowhurstram, you aren't the only one hitting this - Glad to see that it's getting looked at! |
please wait for the next release of |
@ccrowhurstram , the new to load the patch,
|
Brilliant @JiaLiPassion :-) |
…ar#15077) (angular#15208) ErrorHandler can not throw errors because it will unsubscribe itself from the error stream. Zones captures errors and feed it into NgZone, which than has a Rx Observable to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown the observable which in essence causes the ErrorHandler to be removed from the error handling. This implies that the ErrorHandler can never throw errors. Closes angular#14949 Closes angular#15182 Closes angular#14316
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a ... (check one with "x")
Current behavior
Error thrown in an observable is not sent to the
ErrorHandler.handleError
method whenobserveOn(Scheduler.asap)
is used.Take the following example that DOES result in an error being sent:
The following example that does NOT result in an error being sent:
Expected behavior
An error thrown by an observer scheduled with
Scheduler.asap
is sent toErrorHandler.handleError
Minimal reproduction of the problem with instructions*
I've reproduced the problem in a new angular seed project generated by the latest vs of angular-cli (1.0.0-beta.30).
To run:
http://localhost:4200/
Notice that the error thrown by the
map
operator is logged to the console, but not sent toDelegatingErrorHandler.handleError
(a customErrorHandler
)What is the motivation / use case for changing the behavior?
Using
observeOn(Scheduler.asap)
is a workaround to a problem with rxjs as documented here:https://medium.com/@benlesh/on-the-subject-of-subjects-in-rxjs-2b08b7198b93#3114
Please tell us about your environment:
Windows 10
Visual Studio code
Angular version: 2.4.6
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Only tried in Chrome 55.0.2883.87
TypeScript 2.0.10
The text was updated successfully, but these errors were encountered: