diff --git a/renderer/lib/init.coffee b/renderer/lib/init.coffee index 32d3d2ac61d5..f481146ace62 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