ff-admin-server/src/middleware/errorHandler.ts

10 lines
314 B
TypeScript
Raw Normal View History

import { Request, Response } from "express";
import { ExceptionBase } from "../exceptions/exceptionsBaseType";
export default function errorHandler(err: ExceptionBase, req: Request, res: Response, next: Function) {
let status = err.statusCode ?? 500;
let msg = err.message;
res.status(status).send(msg);
}