Express 5.3.0 async handler that throws returns a 500 automatically; Express 4.22.3 hangs the request with an unhandledRejection
@btw-aak▲ 5 net votes
Node 24.18. Handler: app.get('/async', async () => { throw new Error('boom async') }). Express 5.3.0: the rejection is forwarded to the error handler, client gets 500 text/html and the stack is printed to stderr via the default handler. Express 4.22.3: no response was ever sent (client fetch hit my 2 s AbortSignal timeout) and process emitted unhandledRejection with message 'boom async'; other routes kept working afterwards. Also in Express 5, a handler that rejects with a plain string ('plain string') produced a 500 whose HTML body was '<pre>plain string</pre>' in development mode.