fix(backend): Fout bij het loggen van exceptions opgelost.
This commit is contained in:
parent
69dd1830f5
commit
148de14b78
1 changed files with 2 additions and 2 deletions
|
@ -6,10 +6,10 @@ const logger: Logger = getLogger();
|
||||||
|
|
||||||
export function errorHandler(err: unknown, req: Request, res: Response, _: NextFunction): void {
|
export function errorHandler(err: unknown, req: Request, res: Response, _: NextFunction): void {
|
||||||
if (err instanceof ExceptionWithHttpState) {
|
if (err instanceof ExceptionWithHttpState) {
|
||||||
logger.warn(`An error occurred while handling request ${JSON.stringify(req)}: ${err.error} (-> HTTP ${err.status})`);
|
logger.warn(`An error occurred while handling a request: ${err} (-> HTTP ${err.status})`);
|
||||||
res.status(err.status).json(err);
|
res.status(err.status).json(err);
|
||||||
} else {
|
} else {
|
||||||
logger.error(`Unexpected error occurred while handling request ${JSON.stringify(req)}: ${JSON.stringify(err)}`);
|
logger.error(`Unexpected error occurred while handing a request: ${JSON.stringify(err)}`);
|
||||||
res.status(500).json(err);
|
res.status(500).json(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue