betodealmeida commented on a change in pull request #4654: Expose metrics to JS URL: https://github.com/apache/incubator-superset/pull/4654#discussion_r176871595
########## File path: 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; Review comment: The function `sandboxedEval` returns a function (either to mutate the data or generate the tooltip). I'm being consistent here, and returning this ensures that the error is displayed in the tooltip (see second screenshot). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services