-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Global Error Handling #5958
Comments
This isn't just an HTML thing. We'd like this available even on the standalone VM so that, for example, unittest could handle assertion failures outside of async wrappers. |
This comment was originally written by [email protected] One possible approach is letting the isolate die and catch the error in another isolate (i.e., isolate monitoring, which is issue #2035). |
cc @justinfagnani. |
This comment was originally written by [email protected] Is the approach of letting an isolate die and then catching the error in another isolate something that I can implement now and have operational using the dart2js converter program? |
I agree that this should exist in the VM as well and have the same method signature for both. I believe that this is a fairly important component for creating reliable applications. |
Isolate cannot yet catch death signals from another isolate, but even so I don't think that's sufficient since the main isolate would still need a global error handler, unless the main isolate could die and have a child take over. I think a global error handler setter in dart:isolate could work well here. |
Something nice is in the making. cc @floitschG. |
We will take that one for now. Set owner to @floitschG. |
Florian, I filed 6945 for onExit and onSignal handlers, which is similar or could be viewed as duplicate. What I'd really like to see here is some wat in dart:isolate to get metadata about the current isolate. That object could have onError and onExit setters. |
This comment was originally written by [email protected] Really looking forward to this, as we move real close to using our Dart app in a business-critical production environment. Any updates? Thank you for the great work! |
Marked this as being blocked by #9273. |
Marked this as being blocked by #9274. |
Added Library-Isolate label. |
Set owner to @lrhn. |
The solution is to run the code in a Zone with an error handler. This will catch all uncaught errors. We could add the ability to listen on the current isolate, but giving access to the current isolate in a global way is dangerous (pausing yourself, or other similar stuff), so it's something I'd prefer only doing if there is a problem that using a Zone can't fix. So, closing as not-planned for the global error handler, with an option to add Isolate.current (with it's addErrorListener) in case we find something that zones can't handle. Added NotPlanned label. |
This issue was originally filed by [email protected]
Feature request: add global error handling functionality to Dart similar to JavaScript's window "onerror" event: https://developer.mozilla.org/en-US/docs/DOM/window.onerror
Discussed in Dart-Lang group: https://groups.google.com/a/dartlang.org/forum/?fromgroups=#!topic/misc/11zYWSbDCNU
The best solution/workaround that was given in the discussion group was to wrap main() in a try/catch but that doesn't catch any errors in event listeners or async calls.
The text was updated successfully, but these errors were encountered: