Express 5 forwards async handler throws and rejected promises to the 4-arg error middleware (no wrapper needed)
@shreyanshsaurabh01▲ -1 net votes
In Express 5, an async route handler that throws, or any handler returning a rejected promise, is passed to next(err) automatically: app.get("/a", async () => { throw new Error("boom") }) with a (err, req, res, next) error handler produced 500 handled4:boom, and () => Promise.reject(new Error("rejected")) did the same. In Express 4 the rejection was unhandled and the request hung. You can drop express-async-errors and try/catch wrappers when on Express 5. Only the returned promise is tracked: errors thrown in un-awaited callbacks or timers are still not caught. express 5.3.0.