diff --git a/OOMAnalyser.html b/OOMAnalyser.html
index 038ac32..4a7b108 100644
--- a/OOMAnalyser.html
+++ b/OOMAnalyser.html
@@ -205,6 +205,23 @@ function read_and_display_file(file) {
reader.readAsText(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', '
')}`
+
+ let notify_box = document.getElementById('notify_box')
+ notify_box.classList.remove('js-text--display-none')
+ let notification = document.createElement('div')
+ notification.classList.add('js-notify_box__msg--error')
+ notification.innerHTML = text
+ notify_box.appendChild(notification)
+
+ // true - don't propagate the event to the default handler
+ return true
+};
+