Merge pull request #92553 from adamscott/more-meaningful-errors

Make displayed Web errors more meaningful
This commit is contained in:
Rémi Verschelde 2024-05-31 14:16:49 +02:00
commit cf9af1e850
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 16 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
}