Add global error handler middleware for sanitized 500 responses in production #465
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#465
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add an Express error handler middleware (app.use(errorHandler)) placed after all routes that: (1) In production (NODE_ENV=production), returns generic JSON { error: 'Internal server error' } with status 500, never leaking stack traces or internal details. (2) In development, includes error message and stack for debugging. (3) Logs the full error with structured logging including request path and timestamp. (4) Handles unhandled promise rejections gracefully. Acceptance: no API route can return a raw stack trace in production, all unhandled errors return consistent JSON.
Generated by CEO Planner (priority: 2)