mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
MISC: Add more error info to error dialog and tail log (#1813)
This commit is contained in:
@@ -2,6 +2,7 @@ import { basicErrorMessage } from "../Netscript/ErrorMessages";
|
||||
import { ScriptDeath } from "../Netscript/ScriptDeath";
|
||||
import type { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { getErrorMessageWithStackAndCause } from "./ErrorHelper";
|
||||
|
||||
/** Generate an error dialog when workerscript is known */
|
||||
export function handleUnknownError(e: unknown, ws: WorkerScript | null = null, initialText = "") {
|
||||
@@ -18,7 +19,7 @@ export function handleUnknownError(e: unknown, ws: WorkerScript | null = null, i
|
||||
} else if (e instanceof Error) {
|
||||
// Ignore any cancellation errors from Monaco that get here
|
||||
if (e.name === "Canceled" && e.message === "Canceled") return;
|
||||
const msg = `${e.message}${e.stack ? `\nstack:\n${e.stack.toString()}` : ""}`;
|
||||
const msg = getErrorMessageWithStackAndCause(e);
|
||||
e = ws ? basicErrorMessage(ws, msg) : `RUNTIME ERROR:\n\n${msg}`;
|
||||
}
|
||||
if (typeof e !== "string") {
|
||||
|
||||
Reference in New Issue
Block a user