From: Cheng Zhao Date: Sun, 15 Dec 2013 08:32:41 +0000 (+0800) Subject: Redirect window.onerror to uncaughtException. X-Git-Tag: v0.8.0~4^2~36 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=0a84c30d3ba48c4591b1299fbef0f9feaab5dcda;p=electron.git Redirect window.onerror to uncaughtException. --- diff --git a/renderer/lib/init.coffee b/renderer/lib/init.coffee index 32d3d2ac..f481146a 100644 --- a/renderer/lib/init.coffee +++ b/renderer/lib/init.coffee @@ -37,3 +37,11 @@ if window.location.protocol is 'file:' else global.__filename = __filename global.__dirname = __dirname + +# Redirect window.onerror to uncaughtException. +window.onerror = (error) -> + if global.process.listeners('uncaughtException').length > 0 + global.process.emit 'uncaughtException', error + true + else + false