explorer/server/exceptionHandler.ts
2024-08-27 14:34:43 +07:00

10 lines
343 B
TypeScript

import { Request, Response, NextFunction } from 'express';
const exceptionHandler = (fn: (req: Request, res: Response, next: NextFunction) => any) =>
(req: Request, res: Response, next: NextFunction) => {
Promise.resolve(fn(req, res, next)).catch((e) => {
next();
});
};
export default exceptionHandler;