What
The handler logs the rejection but does not call process.exit(1):
process.on("unhandledRejection", (reason) => {
logger.error({ reason }, "Unhandled promise rejection");
});
In Node.js 15+, unhandled rejections crash the process by default. This handler overrides that safety net, allowing the process to continue in a potentially corrupted state.
Why
A database connection leak, an unhandled promise in event processing, or any other async error would be silently swallowed while the process continues operating.
Scope
- Call
process.exit(1) after logging
- Or implement a more sophisticated error recovery
Acceptance Criteria
Technical Context
- File:
src/index.ts, lines 78-80
What
The handler logs the rejection but does not call
process.exit(1):In Node.js 15+, unhandled rejections crash the process by default. This handler overrides that safety net, allowing the process to continue in a potentially corrupted state.
Why
A database connection leak, an unhandled promise in event processing, or any other async error would be silently swallowed while the process continues operating.
Scope
process.exit(1)after loggingAcceptance Criteria
Technical Context
src/index.ts, lines 78-80