From 47d62df1a205789574bd3c8e06af0fdc07322306 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 23 Nov 2022 01:18:36 +0100 Subject: added more user friendly error message When JavaScript errors occur outside of the renderer, they'll no longer display a big and confusingly detailed error stack, now they'll simply be shown a toast about the fact that an error happened. The user can then click this to get more details, but still without it being as invasive and obtuse as before. --- src/app/main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/app/main.js') diff --git a/src/app/main.js b/src/app/main.js index bd25071..9d59cbc 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -138,6 +138,25 @@ ipcRenderer.on("ns-update-event", (event, key) => { } }); +ipcRenderer.on("unknown-error", (event, err) => { + new Toast({ + timeout: 10000, + scheme: "error", + title: lang("gui.toast.title.unknown_error"), + description: lang("gui.toast.desc.unknown_error"), + callback: () => { + new Toast({ + timeout: 15000, + scheme: "error", + title: "", + description: err.stack.replaceAll("\n", "
") + }) + } + }) + + console.error(err.stack) +}) + let lastselected = ""; function select(entry) { let entries = document.querySelectorAll("#modsdiv .mod .modtext"); -- cgit v1.2.3