Express middleware cannot trap errors thrown by async/await, but why?
问题 These two middleware functions behave differently and I cannot figure out why: Here, the error will get trapped by try/catch: router.get('/force_async_error/0', async function (req, res, next) { try{ await Promise.reject(new Error('my zoom 0')); } catch(err){ next(err); } }); But here, the error will not get trapped by try/catch: router.get('/force_async_error/1', async function (req, res, next) { await Promise.reject(new Error('my zoom 1')); }); I thought Express wrapped all middleware