File size: 271 Bytes
0330133
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
/**

 * Error handling wrapper for async route handlers

 * Catches errors and passes them to Express error middleware

 */
export const catchAsync = (fn) => {
  return (req, res, next) => {
    fn(req, res, next).catch(next);
  };
};

export default catchAsync;