express-async-errors
express-async-errors copied to clipboard
is this tool a replcaement of asyncWrapper ?
is this tool a replacement of this :
function asyncWrapper(fn) {
return function (req, res, next) {
fn(req, res, next).catch(next);
};
}
app.get('/route', asyncWrapper(async (req, res, next) => {
const data = await someAsyncOperation();
res.json(data);
}));
yes. stop doing that.