-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Where to put the unhandled error event hook? Looking for ideas/thoughts #3004
Comments
Does spec have any glimpse of preferences where it would be? |
I think for observables, which don't have the "can be handled later" problem that promises have, you just want to deliver it to the global scope. That basically means That's what HostReportErrors means in the spec, as well. |
TIL. Thanks @domenic... I'm in favor of doing this. I'll leave this issue open to discuss whether or not anyone wants to do something RxJS-specific, just to get ideas out there. |
I’m just afraid this will be AngularJS’ $rootScope.on hell all over again |
More of an FYI than a serious suggestion:
Gets reported just like if throwing inside a setTimeout but syncronous. So appears in log at the correct place. |
Hey @benlesh, just want to clarify in light of @domenic's comments: is this still valid:
Or is this: |
Prior art: https://github.com/ReactiveX/RxJava/wiki/Plugins. It could hang off of the Rx global namespace as a hook. Does RxJS have any notion of "hooks" right now? Should it? |
Are we only talking about the unhandledrejection event or are we also looking at the rejectionhandled event. |
@xtianjohns Yes... To disambiguate this... there's rethrowing synchronously (which is the current behavior), and there's rethrowing asynchronously (on a different stack)... which will cause global error reporting to things like We want to move to the later. |
@acutmore .. I'm not sure we can rely on that approach as some huge amount of RxJS use is in Node. |
For version 6, we need to remove the error rethrowing behavior for Observables. Basically this means that if an error propagates to the end of an Observable chain, it will no longer be rethrown, rather, it will be reported to a global error handler. There are a variety of reasons for this that have already been discussed, so I don't want to discuss those here, but the thing we need to know is, where should we put this error handler?
Prior Art: Promises
Promises allow handling unhandled rejections via
window.addEventListener('unhandledrejection', handler)
in a browser orprocess.on('unhandledRejection', handler)
in Node.Caveats
The text was updated successfully, but these errors were encountered: