From 2c3b871b3b03df72749e762913b034cbb564ddd5 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Thu, 30 May 2024 11:01:07 -0400 Subject: [PATCH] Make displayed Web errors more meaningful --- misc/dist/html/editor.html | 11 ++++++++--- misc/dist/html/full-size.html | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index e5c68c63384..5959b7b6643 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -701,9 +701,14 @@ function startEditor(zip) { editor = new Engine(editorConfig); function displayFailureNotice(err) { - const msg = err.message || err; - console.error(msg); - setStatusNotice(msg); + console.error(err); + if (err instanceof Error) { + setStatusNotice(err.message); + } else if (typeof err === 'string') { + setStatusNotice(err); + } else { + setStatusNotice('An unknown error occured'); + } setStatusMode('notice'); initializing = false; } diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index fc34164368a..1d76abe0a56 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -134,9 +134,14 @@ const engine = new Engine(GODOT_CONFIG); } function displayFailureNotice(err) { - const msg = err.message || err; - console.error(msg); - setStatusNotice(msg); + console.error(err); + if (err instanceof Error) { + setStatusNotice(err.message); + } else if (typeof err === 'string') { + setStatusNotice(err); + } else { + setStatusNotice('An unknown error occured'); + } setStatusMode('notice'); initializing = false; }