Unhandled promise rejections no longer kill the whole server if not in development

This commit is contained in:
Konstantin Wohlwend 2026-05-12 13:14:12 -07:00
parent 76023af9d6
commit d2030e826b
2 changed files with 4 additions and 4 deletions

View File

@ -50,8 +50,8 @@ export function ensurePolyfilled() {
captureError("unhandled-promise-rejection", reason);
if (getNodeEnvironment() === "development") {
console.error("\x1b[41mUnhandled promise rejection. Some production environments (particularly Vercel) will kill the server in this case, so the server will now exit. Please use the `ignoreUnhandledRejection` function to signal that you've handled the error.\x1b[0m", reason);
(globalThis as any).process.exit(1);
}
(globalThis as any).process.exit(1);
});
}
}

View File

@ -44,9 +44,9 @@ export function ensurePolyfilled() {
captureError("unhandled-promise-rejection", reason);
if (getNodeEnvironment() === "development") {
console.error("Unhandled promise rejection. Some production environments (particularly Vercel) will kill the server in this case, so the server will now exit. Please use the `ignoreUnhandledRejection` function to signal that you've handled the error.", reason);
}
if ((globalThis.process as any).exit) {
globalThis.process.exit(1);
if ((globalThis.process as any).exit) {
globalThis.process.exit(1);
}
}
});
}