import { Request, Response, NextFunction } from 'express'; import { CustomError } from '../utils/response/custom-error/CustomError.js'; export const errorHandler = (err: CustomError, req: Request, res: Response, next: NextFunction) => { return res.status(err.HttpStatusCode || 500).json(err.JSON || err.stack || err.message); };