Browse Source

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

Make displayed Web errors more meaningful
Rémi Verschelde 1 year ago
parent
commit
cf9af1e850
2 changed files with 16 additions and 6 deletions
  1. 8 3
      misc/dist/html/editor.html
  2. 8 3
      misc/dist/html/full-size.html

+ 8 - 3
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;
 	}

+ 8 - 3
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;
 	}