editor: add console panel under the inspector to ease debugging

This commit is contained in:
bordun 2020-11-09 13:58:04 +01:00
parent 268b9f9be5
commit 528d051093
16 changed files with 404 additions and 233 deletions

View file

@ -661,7 +661,7 @@ class Widget extends EventEmitter {
} catch (err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.log((this.getProp('id') || this.props.id) + '.' + propName + ': JS{{}} error:\n' + err + line)
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': JS{{}} error:\n' + err + line)
}
try {
@ -682,7 +682,7 @@ class Widget extends EventEmitter {
} catch (err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.log((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err + line)
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err + line)
}
for (let k in variables) {

View file

@ -339,7 +339,7 @@ class ScriptVm extends Vm {
if (!options.send) return
toolbar = toolbar || require('../../ui/ui-toolbar')
toolbar = toolbar || require('../../ui/main-menu')
var action = toolbar.entries.filter(x=>!x.separator)

View file

@ -91,7 +91,7 @@ class Script extends Widget {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.log((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
this.script = ()=>{}
}
@ -107,8 +107,10 @@ class Script extends Widget {
this.scriptLock = true
try {
this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
} catch(e) {
console.log(e)
} catch(err) {
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
}
this.scriptLock = false