Skip to content

Commit

Permalink
show error stack instead of generating a message
Browse files Browse the repository at this point in the history
  • Loading branch information
blurymind committed Aug 31, 2024
1 parent f7bb635 commit c6a6515
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/public/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,14 @@ export var Plugins = function (app) {
logMessage.scrollTop = logMessage.scrollHeight;
}
window.addEventListener("error", (e) => {
console.error({e})
const errorText = e.message + "<br>Line: " + (e.lineno - 60 + 1 + ${data.scriptStartLn}) + "<br>Col: " + (e.colno - 4) + "<br> 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();
});
Expand Down
9 changes: 4 additions & 5 deletions src/public/plugins/plugin-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,22 +403,21 @@ export var PluginEditor = function ({
</div>
<div id="js-editor-errors" style="
position: absolute;
bottom: 20px;
bottom: 28px;
right: 20px;
display: none;
color: red;
background: rgba(0, 0, 0, 0.66);
background: rgba(0, 0, 0, 0.75);
padding: 6px;
border-radius: 0.2rem;
font-family: 'Courier New', monospace;
font-size: 0.7rem;
text-align: start;
max-height: 20%;
max-width: 80%;
max-height: 60%;
max-width: 45%;
overflow: auto;
z-index: 9999;
">
error text dkjfghkdfjhgkdfhgkdfjghkdfjghkg
</div>
<div style="position: relative;">
Expand Down

0 comments on commit c6a6515

Please sign in to comment.