misc: better error logging
This commit is contained in:
parent
5bd2bbd5ba
commit
e9607aad77
6 changed files with 23 additions and 19 deletions
|
|
@ -9,6 +9,7 @@ var {updateWidget, incrementWidget} = require('./data-workers'),
|
|||
UiInspector = require('../ui/ui-inspector'),
|
||||
UiTree = require('../ui/ui-tree'),
|
||||
UiDragResize = require('../ui/ui-dragresize'),
|
||||
uiConsole = require('../ui/ui-console'),
|
||||
notifications = require('../ui/notifications'),
|
||||
locales = require('../locales'),
|
||||
{leftUiSidePanel, rightUiSidePanel} = require('../ui/'),
|
||||
|
|
@ -51,16 +52,18 @@ class Editor {
|
|||
w.props[propName] = previousValue
|
||||
updateWidget(w, {changedProps: [propName], preventSelect: this.selectedWidgets.length > 1})
|
||||
|
||||
notifications.add({
|
||||
if (uiConsole.minimized || rightUiSidePanel.minimized) notifications.add({
|
||||
class: 'error',
|
||||
message: locales('inspector_error'),
|
||||
duration: 7000
|
||||
})
|
||||
console.error(
|
||||
`Error while setting ${propName} to: ${JSON.stringify(value)}.`,
|
||||
'It\'s probably a bug, please a new bug ticket with these informations (https://github.com/jean-emmanuel/open-stage-control/issues).'
|
||||
`Error while setting ${propName} to: ${JSON.stringify(value)}.\n` +
|
||||
'It\'s probably a bug, please open a new bug ticket with the followigin informations at' +
|
||||
'https://github.com/jean-emmanuel/open-stage-control/issues'
|
||||
)
|
||||
console.error(e)
|
||||
throw e
|
||||
// console.error(e)
|
||||
error = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
// inspector
|
||||
inspector_color_confirm: 'Confirm',
|
||||
inspector_color_apply: 'Apply',
|
||||
inspector_error: 'An error just occured, open F12 to read more.',
|
||||
inspector_error: 'An error just occured, open the console to read more.',
|
||||
|
||||
// nosleep
|
||||
nosleep: 'Prevent sleep',
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ module.exports = {
|
|||
// inspector
|
||||
inspector_color_confirm: 'Confirmer',
|
||||
inspector_color_apply: 'Appliquer',
|
||||
inspector_error: 'Une erreur vient de survenir, appuyez sur F12 pour en savoir plus.',
|
||||
inspector_error: 'Une erreur vient de survenir, ouvrez la console pour en savoir plus.',
|
||||
|
||||
// nosleep
|
||||
nosleep: 'Empêcher la veille',
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ window.onerror = function(msg,url,row,col, error) {
|
|||
|
||||
}).join('\n')
|
||||
|
||||
console.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)`)
|
||||
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ class UiConsole extends UiSidePanel {
|
|||
error(...arguments)
|
||||
}
|
||||
|
||||
window.onerror = function(message){
|
||||
_this.log('error', message)
|
||||
onerror(...arguments)
|
||||
}
|
||||
// window.onerror = function(message){
|
||||
// _this.log('error', message)
|
||||
// onerror(...arguments)
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
@ -82,9 +82,13 @@ class UiConsole extends UiSidePanel {
|
|||
`)
|
||||
|
||||
if (typeof message === 'object') {
|
||||
try {
|
||||
message = JSON.stringify(message)
|
||||
} catch (_) {}
|
||||
if (!(message instanceof Error)) {
|
||||
try {
|
||||
message = JSON.stringify(message)
|
||||
} catch (_) {}
|
||||
} else {
|
||||
message = String(message) + message.stack
|
||||
}
|
||||
}
|
||||
|
||||
node.textContent = message
|
||||
|
|
|
|||
|
|
@ -69,12 +69,7 @@ class Input extends Canvas {
|
|||
|
||||
if (!validator.match(/^\^.*\$$/)) validator = '^' + validator + '$'
|
||||
|
||||
try {
|
||||
this.fieldValidator = new RegExp(validator, flags)
|
||||
} catch(err) {
|
||||
console.error((this.getProp('id') || this.props.id) + '.' + propName + ':\n')
|
||||
console.error(err)
|
||||
}
|
||||
this.fieldValidator = new RegExp(validator, flags)
|
||||
}
|
||||
|
||||
this.input.addEventListener('keydown', (e)=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue