diff --git a/superset/assets/javascripts/modules/sandbox.js b/superset/assets/javascripts/modules/sandbox.js index 3439c0319f9f6..a139013d592b0 100644 --- a/superset/assets/javascripts/modules/sandbox.js +++ b/superset/assets/javascripts/modules/sandbox.js @@ -22,6 +22,10 @@ export default function sandboxedEval(code, context, opts) { Object.keys(sandboxContext).forEach(function (key) { sandbox[key] = sandboxContext[key]; }); - vm.runInNewContext(codeToEval, sandbox, opts); - return sandbox[resultKey]; + try { + vm.runInNewContext(codeToEval, sandbox, opts); + return sandbox[resultKey]; + } catch (error) { + return () => error; + } } diff --git a/superset/viz.py b/superset/viz.py index 0c552623258ea..ebcbac4a93e33 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2037,6 +2037,7 @@ def get_metrics(self): def get_properties(self, d): return { + 'metric': d.get(self.metric), 'radius': self.fixed_value if self.fixed_value else d.get(self.metric), 'cat_color': d.get(self.dim) if self.dim else None, 'position': d.get('spatial'),