js: fix formatting
This commit is contained in:
parent
2eed3daa78
commit
a904f1bb0d
1 changed files with 13 additions and 1 deletions
|
|
@ -2,15 +2,27 @@ var StackTrace = require('stacktrace-js'),
|
|||
ipc = require('./ipc')
|
||||
|
||||
window.onerror = function(msg,url,row,col, error) {
|
||||
|
||||
StackTrace.fromError(error).then((stackframes)=>{
|
||||
|
||||
var stringifiedStack = stackframes.filter((sf)=>{
|
||||
|
||||
return !sf.fileName.match('browser-pack')
|
||||
|
||||
}).map(function(sf) {
|
||||
|
||||
if (sf.functionName.match(/Object\./)) sf.functionName = 'require'
|
||||
|
||||
return ` at ${sf.functionName} (${sf.fileName}:${sf.lineNumber}:${sf.columnNumber})`
|
||||
}).join('\n');
|
||||
|
||||
}).join('\n')
|
||||
|
||||
ipc.send('errorLog', `[Renderer process error]\n${msg}\n${stringifiedStack}`)
|
||||
|
||||
}).catch(()=>{
|
||||
|
||||
ipc.send('errorLog', `[Renderer process error]\n${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue