MISC: Change message of Singularity error and uncaught promise error (#2174)

This commit is contained in:
catloversg
2025-06-22 04:29:59 +07:00
committed by GitHub
parent 38d033368e
commit 9ba1bc7cfb
2 changed files with 4 additions and 11 deletions

View File

@@ -363,8 +363,7 @@ function checkSingularityAccess(ctx: NetscriptContext): void {
if (!canAccessBitNodeFeature(4)) {
throw errorMessage(
ctx,
`This singularity function requires Source-File 4 to run. A power up you obtain later in the game.
It will be very obvious when and how you can obtain it.`,
`This singularity function requires Source-File 4 to run. A power up you obtain later in the game. It will be very obvious when and how you can obtain it.`,
"API ACCESS",
);
}
@@ -381,10 +380,8 @@ function checkEnvFlags(ctx: NetscriptContext): void {
log(ctx, () => "Failed to run due to failed concurrency check.");
const err = errorMessage(
ctx,
`Concurrent calls to Netscript functions are not allowed!
Did you forget to await hack(), grow(), or some other
promise-returning function?
Currently running: ${ws.env.runningFn} tried to run: ${ctx.function}`,
"Concurrent calls to Netscript functions are not allowed! Did you forget to await hack(), grow(), or some other " +
`promise-returning function?\nCurrently running: ${ws.env.runningFn}\nTried to run: ${ctx.function}`,
"CONCURRENCY",
);
killWorkerScript(ws);

View File

@@ -3,10 +3,6 @@ import { handleUnknownError } from "./utils/ErrorHandler";
export function setupUncaughtPromiseHandler(): void {
window.addEventListener("unhandledrejection", (e) => {
e.preventDefault();
handleUnknownError(
e.reason,
null,
"UNCAUGHT PROMISE ERROR\nYou forgot to await a promise\nmaybe hack / grow / weaken ?\n\n",
);
handleUnknownError(e.reason, null, "UNCAUGHT PROMISE ERROR. Caused by:\n\n");
});
}