chatty / utilities /catchAsyncError.js
arabdullah's picture
@ARAbdullaSL
a0fda44 verified
const ReqError = require("./ReqError");
module.exports = function (fn) {
return function (req, res, next) {
fn(req, res, next).catch((error) => next(new ReqError(400, error)));
};
};