From f2fa6bf45ca9d9c8ce8032c2f924f41c8aadcbd9 Mon Sep 17 00:00:00 2001 From: Anna Waldron Date: Wed, 7 Nov 2018 13:30:49 -0800 Subject: [PATCH] Issue #72 - Adding try/catch for errors in parsing plot config element --- ait/gui/static/js/ait/gui/Plot.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ait/gui/static/js/ait/gui/Plot.js b/ait/gui/static/js/ait/gui/Plot.js index 6c122e86..abef84a8 100644 --- a/ait/gui/static/js/ait/gui/Plot.js +++ b/ait/gui/static/js/ait/gui/Plot.js @@ -353,7 +353,16 @@ const Plot = */ processTag (vnode) { if (vnode.tag === 'ait-plotconfig') { - this._backend.handleOptionsOverride(this._options, JSON.parse(vnode.text)) + try { + this._backend.handleOptionsOverride(this._options, JSON.parse(vnode.text)) + } + catch(error) { + if (error instanceof SyntaxError) { + console.error('Error parsing plot config. Printing trace back ' + + 'and reverting to default options.') + } + console.error(error) + } } else if (vnode.tag === 'ait-plotseries') { this.processTagSeries(vnode)