Make displayed Web errors more meaningful

This commit is contained in:
Adam Scott 2024-05-30 11:01:07 -04:00
parent e7dd6f11ed
commit 2c3b871b3b
No known key found for this signature in database
GPG Key ID: F6BA2A0302E21A77
2 changed files with 16 additions and 6 deletions

View File

@ -701,9 +701,14 @@ function startEditor(zip) {
editor = new Engine(editorConfig); editor = new Engine(editorConfig);
function displayFailureNotice(err) { function displayFailureNotice(err) {
const msg = err.message || err; console.error(err);
console.error(msg); if (err instanceof Error) {
setStatusNotice(msg); setStatusNotice(err.message);
} else if (typeof err === 'string') {
setStatusNotice(err);
} else {
setStatusNotice('An unknown error occured');
}
setStatusMode('notice'); setStatusMode('notice');
initializing = false; initializing = false;
} }

View File

@ -134,9 +134,14 @@ const engine = new Engine(GODOT_CONFIG);
} }
function displayFailureNotice(err) { function displayFailureNotice(err) {
const msg = err.message || err; console.error(err);
console.error(msg); if (err instanceof Error) {
setStatusNotice(msg); setStatusNotice(err.message);
} else if (typeof err === 'string') {
setStatusNotice(err);
} else {
setStatusNotice('An unknown error occured');
}
setStatusMode('notice'); setStatusMode('notice');
initializing = false; initializing = false;
} }