bitburner-src/src/UncaughtPromiseHandler.ts
2024-02-26 08:05:10 -05:00

13 lines
364 B
TypeScript

import { handleUnknownError } from "./Netscript/ErrorMessages";
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",
);
});
}