Express 4 was designed before async/await. It does not catch promise rejections from async handlers. The handler returns a rejected promise that Express ignores, and the client hangs.
Async Error Handling in Express: Best Practices
Why does Express 4 not catch async errors?
The answer
More FAQs in Async Error Handling in Express: Best Practices
Wrap async handlers with asyncHandler: Promise.resolve(fn(req, res, next)).catch(next). The wrapper catches promise rejections and passes them to the error handler. Then you can throw inside async handlers.
Yes. Express 5 catches promise rejections from async handlers and passes them to the error handler. The asyncHandler wrapper is still useful for older versions.
A safety net. process.on('unhandledRejection') and process.on('uncaughtException') catch what your middleware misses. They should not be your main strategy, but they prevent silent crashes. uncaughtException should usually exit the process.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.