12 lines
226 B
JavaScript
12 lines
226 B
JavaScript
|
|
const catchAsync = (fn) => {
|
||
|
|
return async (req, res, next) => {
|
||
|
|
try {
|
||
|
|
await fn(req, res, next);
|
||
|
|
}
|
||
|
|
catch (error) {
|
||
|
|
next(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
};
|
||
|
|
export default catchAsync;
|