type and controller
This commit is contained in:
parent
88212ff79b
commit
d24785cd69
4 changed files with 7 additions and 5 deletions
|
@ -5,15 +5,13 @@ import CustomRequestException from "../exceptions/customRequestException";
|
|||
export default function errorHandler(err: ExceptionBase | Error, req: Request, res: Response, next: Function) {
|
||||
let status = 500;
|
||||
let msg = "Internal Server Error";
|
||||
let insideError = undefined;
|
||||
|
||||
if (err instanceof CustomRequestException) {
|
||||
status = err.statusCode;
|
||||
msg = err.message;
|
||||
insideError = err.err;
|
||||
}
|
||||
|
||||
console.log("Handler", err, insideError);
|
||||
console.log("Handler", err);
|
||||
|
||||
res.status(status).send(msg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue