catch scripts taht end too early

This commit is contained in:
Olivier Gagnon 2021-12-20 16:06:19 -05:00
parent b57ac45698
commit 009bae5870

@ -1,3 +1,4 @@
import { WorkerScript } from "./Netscript/WorkerScript";
import { isScriptErrorMessage } from "./NetscriptEvaluator"; import { isScriptErrorMessage } from "./NetscriptEvaluator";
import { dialogBoxCreate } from "./ui/React/DialogBox"; import { dialogBoxCreate } from "./ui/React/DialogBox";
@ -13,6 +14,11 @@ export function setupUncaughtPromiseHandler(): void {
msg += "<br>"; msg += "<br>";
msg += errorMsg; msg += errorMsg;
dialogBoxCreate(msg); dialogBoxCreate(msg);
} else if (e.reason instanceof WorkerScript) {
const msg =
`UNCAUGHT PROMISE ERROR<br>You forgot to await a promise<br>${e.reason.name}@${e.reason.hostname}<br>` +
`Maybe hack / grow / weaken ?`;
dialogBoxCreate(msg);
} }
}); });
} }