Is there any kind of javascript error that is not handled by onerror in an ember(-cli) application? In other terms, is there any need to add a handler to window.onerror?
In my tests I could not come up with any error that would no be handled by Ember's onerror. Syntax errors didn't get past ember-cli's build process.
EmberJS does an excellent job of containing errors that happen within its boundaries. Errors caused by your Ember code should all get funneled into the Ember-specific handler.
However, browser JavaScript is a complicated beast. Any JavaScript errors that happen outside of Ember would not be captured internally and may only be exposed by the global window.onerror
. Some examples of these could include:
setTimeout
and addEventListener
To get a complete picture of what is happening with your visitors, you should probably attach to both Ember.onerror
and window.onerror
and send the reports back to your logs. Even if you are not actively developing, browser changes can cause sudden bugs to appear in your application. Like this webkit bug that caused ember to throw errors. There are good options to record errors automatically from Ember apps, like TrackJS.
Disclosure: I am one of the founding developers of TrackJS, so I've debugged a lot of errors :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With