bitburner-src/src/UncaughtPromiseHandler.ts

13 lines
364 B
TypeScript
Raw Normal View History

import { handleUnknownError } from "./Netscript/ErrorMessages";
2021-12-20 19:57:07 +01:00
export function setupUncaughtPromiseHandler(): void {
2022-09-05 15:55:57 +02:00
window.addEventListener("unhandledrejection", (e) => {
e.preventDefault();
2022-09-05 15:55:57 +02:00
handleUnknownError(
e.reason,
null,
"UNCAUGHT PROMISE ERROR\nYou forgot to await a promise\nmaybe hack / grow / weaken ?\n\n",
);
});
2021-12-20 19:57:07 +01:00
}