From c6a6515ec5413af171d10a0a2508d540c935291f Mon Sep 17 00:00:00 2001 From: blurymind Date: Sat, 31 Aug 2024 12:41:37 +0100 Subject: [PATCH] show error stack instead of generating a message --- src/public/plugins/index.js | 7 ++++--- src/public/plugins/plugin-editor.js | 9 ++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/public/plugins/index.js b/src/public/plugins/index.js index b6bdcc96..7d807062 100644 --- a/src/public/plugins/index.js +++ b/src/public/plugins/index.js @@ -428,13 +428,14 @@ export var Plugins = function (app) { logMessage.scrollTop = logMessage.scrollHeight; } window.addEventListener("error", (e) => { + console.error({e}) const errorText = e.message + "
Line: " + (e.lineno - 60 + 1 + ${data.scriptStartLn}) + "
Col: " + (e.colno - 4) + "
Please see console for more details.."; - logOfConsole.push({type: 'error', arguments: [errorText]}); - logOfErrors.push({type: 'error', arguments: [errorText]}); + logOfConsole.push({type: 'error', arguments: [e.error.stack || e.message]}); + logOfErrors.push({type: 'error', arguments: [e.error.stack || e.message]}); onUpdateConsoleLogsInternal(); }); window.addEventListener('unhandledrejection', e => { - console.log({e}) + console.error({e}) logOfErrors.push({type: 'error', arguments: [e.reason.stack]}); onUpdateConsoleLogsInternal(); }); diff --git a/src/public/plugins/plugin-editor.js b/src/public/plugins/plugin-editor.js index 273995d8..8e2a4d62 100644 --- a/src/public/plugins/plugin-editor.js +++ b/src/public/plugins/plugin-editor.js @@ -403,22 +403,21 @@ export var PluginEditor = function ({