]> khamidou — GitHub mirrors - electron.git/commit
emit error object on process.on('uncaughtException') in renderer
authorJP Richardson <jprichardson@gmail.com>
Fri, 10 Jul 2015 19:38:03 +0000 (14:38 -0500)
committerJP Richardson <jprichardson@gmail.com>
Fri, 10 Jul 2015 19:38:03 +0000 (14:38 -0500)
commitd6ae874038400a0c9367f8a6c14d62e5a951c907
tree5755b0815162cc7ba191e6de33b4c0512b6c73a7
parent967c273ddb8d0694109b930b8a86f6ef1576da6c
emit error object on process.on('uncaughtException') in renderer

Chromium added the actual `error` object to the 5th parameter in `window.onerror`. This should be emitted as opposed to the `errorMsg` string. Worse yet, since `errorMsg` wasn't an instance of `Error`, any code that assumes this in any `process.on('uncaughtException')` handler would fail. Also, correctly emitting the error provides the stack trace.

This is now an HTML5 standard.

Sources:
- https://html.spec.whatwg.org/multipage/webappapis.html#errorevent
- https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
- https://code.google.com/p/chromium/issues/detail?id=147127
atom/renderer/lib/init.coffee