mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-14 18:43:57 +00:00
16 lines
437 B
TypeScript
16 lines
437 B
TypeScript
import HttpException from "../common/http-exception";
|
|
import { Request, Response, NextFunction } from "express";
|
|
|
|
export const errorHandler = (
|
|
error: HttpException,
|
|
request: Request,
|
|
response: Response,
|
|
next: NextFunction
|
|
) => {
|
|
const status = error.statusCode || 500;
|
|
const message =
|
|
error.message || "It's not you. It's us. We are having some problems.";
|
|
|
|
response.status(status).send(message);
|
|
};
|