Skip to content

Commit d2030e8

Browse files
committed
Unhandled promise rejections no longer kill the whole server if not in development
1 parent 76023af commit d2030e8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/backend/src/polyfills.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function ensurePolyfilled() {
5050
captureError("unhandled-promise-rejection", reason);
5151
if (getNodeEnvironment() === "development") {
5252
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);
53+
(globalThis as any).process.exit(1);
5354
}
54-
(globalThis as any).process.exit(1);
5555
});
5656
}
5757
}

apps/dashboard/src/polyfills.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export function ensurePolyfilled() {
4444
captureError("unhandled-promise-rejection", reason);
4545
if (getNodeEnvironment() === "development") {
4646
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);
47-
}
48-
if ((globalThis.process as any).exit) {
49-
globalThis.process.exit(1);
47+
if ((globalThis.process as any).exit) {
48+
globalThis.process.exit(1);
49+
}
5050
}
5151
});
5252
}

0 commit comments

Comments
 (0)