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

Need a global error handler primitive in dart2js. #9274

Closed
floitschG opened this issue Mar 19, 2013 · 16 comments
Closed

Need a global error handler primitive in dart2js. #9274

floitschG opened this issue Mar 19, 2013 · 16 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant web-dart2js

Comments

@floitschG
Copy link
Contributor

We need a way to set the global error-handler. For now just having a private dart2js specific implementation is good enough. We can then provide a public API on top of it.

Also see issue #9273 and issue #9012.

@floitschG
Copy link
Contributor Author

Marked this as blocking #5958.

@floitschG
Copy link
Contributor Author

Added some comments on what we want to issue #9273 (the VM counterpart of this bug).

@kasperl
Copy link

kasperl commented Apr 22, 2013

Added this to the Later milestone.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

Removed TriageForM5 label.

@kasperl
Copy link

kasperl commented Sep 18, 2013

Removed this from the Later milestone.
Added this to the M7 milestone.

@kasperl
Copy link

kasperl commented Sep 23, 2013

Set owner to @kasperl.

@kasperl
Copy link

kasperl commented Oct 2, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@DartBot
Copy link

DartBot commented Nov 7, 2013

This comment was originally written by @bjornm


I cannot find a uniform way to catch all unhandled errors. I see unhandled errors arising in the following situations:

a) inside main()
b) when invoking async closures (futures, timers etc)
c) when handling a browser event
d) in javascript code on page (called from dart, or running by itself)

The RootZone seems to be able to deal with some of these cases but it lacks documentation. I can't seem to be able to override the default behavior for unhandled errors?

For now, I've resorted to listening to the window.addEventListener('error'). However, when the AsyncErrors bubble this far, the trace is lost due to wrapException():

Uncaught Illegal argument(s): foobar Instance of 'ErrorEvent' Error
    at Object.wrapException (studio.dart.js:2706:13)
    at _rootHandleUncaughtError__closure.call$0 (studio.dart.js:7638:13)
    at Closure$0._asyncRunCallback as call$0
    at TimerImpl_internalCallback0.call$0 (studio.dart.js:2384:21)
    at invokeClosure_closure.call$0 (studio.dart.js:3649:27)
    at _IsolateContext.eval$1 (studio.dart.js:1700:21)
    at Object._callInIsolate (studio.dart.js:1450:24)
    at invokeClosure (studio.dart.js:2847:14)
    at studio.dart.js:2867:106

 As a workaround I'm overriding dartPrint() so I can grab the original stackTrace written by the RootZone error handler for later processing. But it would be nice with a cleaner way to do this.

@floitschG
Copy link
Contributor Author

The following should capture all errors.

main() {
  runZoned(() { <original_main> }),
           onError: (error, stackTrace) { <deal with error> })
}

We are also planning to provide other means to deal with uncaught errors, by sending control-messages to the isolate.

@kasperl
Copy link

kasperl commented Feb 21, 2014

Added Accepted label.

@kasperl
Copy link

kasperl commented Feb 21, 2014

Set owner to @floitschG.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@lrhn
Copy link
Member

lrhn commented Oct 7, 2014

Zones is the solution to capturing errors.


Added AssumedStale label.

@floitschG floitschG added Type-Defect web-dart2js closed-obsolete Closed as the reported issue is no longer relevant labels Oct 7, 2014
@floitschG floitschG self-assigned this 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
closed-obsolete Closed as the reported issue is no longer relevant web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants