瀏覽代碼

Make displayed Web errors more meaningful

Adam Scott 1 年之前
父節點
當前提交
2c3b871b3b
共有 2 個文件被更改,包括 16 次插入6 次删除
  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;
 	}