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

Global Error Handling #5958

Closed
DartBot opened this issue Oct 16, 2012 · 16 comments
Closed

Global Error Handling #5958

DartBot opened this issue Oct 16, 2012 · 16 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-isolate

Comments

@DartBot
Copy link

DartBot commented Oct 16, 2012

This issue was originally filed by lukema...@gmail.com


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.

@dgrove
Copy link
Contributor

dgrove commented Oct 16, 2012

Added Area-HTML, Triaged labels.

@munificent
Copy link
Member

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.

@DartBot
Copy link
Author

DartBot commented Oct 17, 2012

This comment was originally written by ladicek@gmail.com


One possible approach is letting the isolate die and catch the error in another isolate (i.e., isolate monitoring, which is issue #2035).

@dgrove
Copy link
Contributor

dgrove commented Oct 17, 2012

cc @justinfagnani.
cc @madsager.
cc @blois.
Removed Area-HTML label.

@DartBot
Copy link
Author

DartBot commented Oct 17, 2012

This comment was originally written by lukema...@gmail.com


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?

@blois
Copy link
Contributor

blois commented Oct 17, 2012

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.

@justinfagnani
Copy link
Contributor

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.

@anders-sandholm
Copy link
Contributor

Something nice is in the making.
Florian+team should be able to give an update later.


cc @floitschG.
Added Area-Library label.

@floitschG
Copy link
Contributor

We will take that one for now.
If the VM, html or dart2js team has suggestions or wants to move forward without waiting for us, don't hesitate to contact us or take it over.


Set owner to @floitschG.
Added Accepted label.

@justinfagnani
Copy link
Contributor

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.

@DartBot
Copy link
Author

DartBot commented Mar 18, 2013

This comment was originally written by daven...@gmail.com


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!

@floitschG
Copy link
Contributor

Marked this as being blocked by #9273.

@floitschG
Copy link
Contributor

Marked this as being blocked by #9274.

@lrhn
Copy link
Member

lrhn commented Apr 30, 2014

Added Library-Isolate label.

@floitschG
Copy link
Contributor

Set owner to @lrhn.

@lrhn
Copy link
Member

lrhn commented Oct 7, 2014

The solution is to run the code in a Zone with an error handler. This will catch all uncaught errors.
An alternative is to run the code in another isolate, and listen on the uncaught errors of that isolate (when implemented).

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.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate closed-not-planned Closed as we don't intend to take action on the reported issue labels Oct 7, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-isolate
Projects
None yet
Development

No branches or pull requests

8 participants