Files

9 lines
241 B
JavaScript

// Async wrapper utility to catch async errors and pass them to Express error handler
const asyncWrapper = (fn) => {
return (req, res, next) => {
Promise.resolve(fn(req, res, next)).catch(next);
};
};
module.exports = asyncWrapper;