console: hook stacktrace to uiConsole directly

This commit is contained in:
bordun 2020-11-09 19:38:17 +01:00
parent e9607aad77
commit 53c32420d1
2 changed files with 4 additions and 10 deletions

View file

@ -1,5 +1,6 @@
var StackTrace = require('stacktrace-js'),
ipc = require('./ipc')
ipc = require('./ipc'),
uiConsole = require('./ui/ui-console')
window.onerror = function(msg,url,row,col, error) {
@ -17,12 +18,12 @@ window.onerror = function(msg,url,row,col, error) {
}).join('\n')
console.error(`${msg}\n${stringifiedStack}`)
uiConsole.log('error', `${msg}\n${stringifiedStack}`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n${stringifiedStack}`)
}).catch(()=>{
console.error(`${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
uiConsole.log('error', `${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
})

View file

@ -43,13 +43,6 @@ class UiConsole extends UiSidePanel {
error(...arguments)
}
// window.onerror = function(message){
// _this.log('error', message)
// onerror(...arguments)
// }
// this.input.addEventListener('keydown', (event)=>{
// if (event.keyCode === 13 && !event.shiftKey) {
//