From 5e85baa2787e63bb5519fd1a7fc6b239d507781b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 18 Jan 2022 12:32:34 +0100 Subject: [PATCH] scripting: regression: missing try catch on code compilation --- src/client/widgets/scripts/script.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/client/widgets/scripts/script.js b/src/client/widgets/scripts/script.js index 53690be3..fd06e3d8 100644 --- a/src/client/widgets/scripts/script.js +++ b/src/client/widgets/scripts/script.js @@ -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 + } }