scripting: regression: missing try catch on code compilation

This commit is contained in:
jean-emmanuel 2022-01-18 12:32:34 +01:00
parent 291eb669c5
commit 5e85baa278

View file

@ -1,5 +1,6 @@
var ScriptVm = require('./script-vm'),
scriptVm = new ScriptVm()
scriptVm = new ScriptVm(),
noop = ()=>{}
class Script {
@ -13,11 +14,16 @@ class Script {
if (!options.code) {
this.script = ()=>{}
this.script = noop
} else {
this.script = scriptVm.compile(options.code, options.context)
try {
this.script = scriptVm.compile(options.code, options.context)
} catch(err) {
this.widget.errorProp(this.property, 'javascript', err)
this.script = noop
}
}