diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-29 16:58:23 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-29 16:58:23 +0200 |
commit | 7674149085ca1bc61159870946bccb40d53bac89 (patch) | |
tree | 09843cf48d5048d0de41ece659bf1d57dfa5aa04 /api/src/middlewares/ErrorHandler.ts | |
parent | :sparkles: typeorm gateway (diff) | |
download | server-7674149085ca1bc61159870946bccb40d53bac89.tar.xz |
fix rate limit
Diffstat (limited to 'api/src/middlewares/ErrorHandler.ts')
-rw-r--r-- | api/src/middlewares/ErrorHandler.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts index 8e2cd923..0ed37bb4 100644 --- a/api/src/middlewares/ErrorHandler.ts +++ b/api/src/middlewares/ErrorHandler.ts @@ -4,7 +4,7 @@ import { FieldError } from "../util/instanceOf"; // TODO: update with new body/typorm validation export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) { - if (!error) next(); + if (!error) return next(); try { let code = 400; @@ -18,7 +18,6 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne message = error.message; errors = error.errors; } else { - console.error(error); if (req.server?.options?.production) { message = "Internal Server Error"; } @@ -27,7 +26,7 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne if (httpcode > 511) httpcode = 400; - console.error(`[Error] ${code} ${req.url} ${message}`, errors || error); + console.error(`[Error] ${code} ${req.url}`, errors || error, "body:", req.body); res.status(httpcode).json({ code: code, message, errors }); } catch (error) { |