explorer/server/exceptionHandler.ts
2024-08-11 16:12:51 +07:00

8 lines
318 B
TypeScript

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