From 8b7e8b5049a2f4ca05b4c984b29bb739bf149ae2 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Mon, 27 Dec 2021 22:24:25 +0100 Subject: [PATCH] Improved output for uncaught errors --- OOMAnalyser.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OOMAnalyser.html b/OOMAnalyser.html index dad2fae..05e2a26 100644 --- a/OOMAnalyser.html +++ b/OOMAnalyser.html @@ -270,10 +270,14 @@ function read_and_display_file(file) { } // Report uncaught errors to the user -window.onerror = function (msg, url, lineNo, columnNo, error) { - let text = `INTERNAL ERROR: ${msg} at ${url}:${lineNo}:${columnNo}
` + - `Details: ${error.__args__}
` + - `${error.stack.replaceAll('\n', '
')}` +window.onerror = function (msg, url, lineNo, columnNo, errorObj) { + let text = `INTERNAL ERROR:
${msg} at ${url}:${lineNo}:${columnNo}
` + if ('__args__' in errorObj && errorObj.__args__ !== undefined) { + text += `Details: ${errorObj.__args__}
` + } + if ('stack' in errorObj && errorObj.stack !== undefined) { + text += `Stack trace:
${errorObj.stack.replaceAll('\n', '
')}` + } let notify_box = document.getElementById('notify_box') notify_box.classList.remove('js-text--display-none') -- 2.34.2