Improve unexpected error message ()

* Add ws details if available
* Add likely cause of error
* Attempt to display error
This commit is contained in:
Snarling 2022-10-19 16:32:39 -04:00 committed by GitHub
parent b6efe46d4c
commit 124e64379a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -751,8 +751,10 @@ export function handleUnknownError(e: unknown, ws: WorkerScript | ScriptDeath |
e = ws ? makeBasicErrorMsg(ws, msg) : `RUNTIME ERROR:\n\n${msg}`;
}
if (typeof e !== "string") {
console.error("Unexpected error type:", e);
e = "Unexpected type of error thrown. See console output.";
console.error("Unexpected error:", e);
const msg = `Unexpected type of error thrown. This error was likely thrown manually within a script.
Error has been logged to the console.\n\nType of error: ${typeof e}\nValue of error: ${e}`;
e = ws ? makeBasicErrorMsg(ws, msg, "UNKNOWN") : msg;
}
dialogBoxCreate(initialText + e);
}