patches v1.0.1 #38

Merged
jkeffects merged 4 commits from develop into main 2025-01-10 11:10:01 +00:00
Showing only changes of commit 55d4a952c3 - Show all commits

View file

@ -1,6 +1,7 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import { ExceptionBase } from "../exceptions/exceptionsBaseType"; import { ExceptionBase } from "../exceptions/exceptionsBaseType";
import CustomRequestException from "../exceptions/customRequestException"; import CustomRequestException from "../exceptions/customRequestException";
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
export default function errorHandler(err: ExceptionBase | Error, req: Request, res: Response, next: Function) { export default function errorHandler(err: ExceptionBase | Error, req: Request, res: Response, next: Function) {
let status = 500; let status = 500;
@ -11,7 +12,11 @@ export default function errorHandler(err: ExceptionBase | Error, req: Request, r
msg = err.message; msg = err.message;
} }
console.log("Handler", err); if (err instanceof CustomRequestException) {
console.log("Custom Handler", status, msg);
} else {
console.log("Error Handler", err);
}
res.status(status).send(msg); res.status(status).send(msg);
} }