~carstengrohmann/OOMAnalyser

8b7e8b5049a2f4ca05b4c984b29bb739bf149ae2 — Carsten Grohmann 5 months ago 7d6ba19
Improved output for uncaught errors
1 files changed, 8 insertions(+), 4 deletions(-)

M OOMAnalyser.html
M OOMAnalyser.html => OOMAnalyser.html +8 -4
@@ 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}<br> ` +
        `Details: ${error.__args__} <br>` +
        `${error.stack.replaceAll('\n', '<br>')}`
window.onerror = function (msg, url, lineNo, columnNo, errorObj) {
    let text = `INTERNAL ERROR:<br>${msg} at ${url}:${lineNo}:${columnNo}<br> `
    if ('__args__' in errorObj && errorObj.__args__ !== undefined) {
        text += `Details: ${errorObj.__args__} <br>`
    }
    if ('stack' in errorObj && errorObj.stack !== undefined) {
        text += `Stack trace:</br>${errorObj.stack.replaceAll('\n', '<br>')}`
    }

    let notify_box = document.getElementById('notify_box')
    notify_box.classList.remove('js-text--display-none')