Add process-level unhandled rejection and exception handlers to Express server #683

Open
opened 2026-04-11 12:16:30 -04:00 by pook · 0 comments
Owner

Same critical reliability gap as contractpilot — without these handlers, the server crashes silently on unhandled promise rejections, losing in-flight document generation requests.

Implementation:

  1. In the Express app entry point, add:
    • process.on('unhandledRejection', (reason, promise) => { logger.error('Unhandled Rejection', { reason }); })
    • process.on('uncaughtException', (error) => { logger.error('Uncaught Exception', { error }); process.exit(1); })
  2. Use the existing logger module.
  3. uncaughtException handler must call process.exit(1) for clean container restart.
  4. Add unit test verifying handlers are registered and log correctly.

Acceptance: Both handlers registered, test passing, no new dependencies.


Generated by CEO Planner (priority: 2)

Same critical reliability gap as contractpilot — without these handlers, the server crashes silently on unhandled promise rejections, losing in-flight document generation requests. Implementation: 1. In the Express app entry point, add: - `process.on('unhandledRejection', (reason, promise) => { logger.error('Unhandled Rejection', { reason }); })` - `process.on('uncaughtException', (error) => { logger.error('Uncaught Exception', { error }); process.exit(1); })` 2. Use the existing logger module. 3. uncaughtException handler must call `process.exit(1)` for clean container restart. 4. Add unit test verifying handlers are registered and log correctly. Acceptance: Both handlers registered, test passing, no new dependencies. --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#683
No description provided.