From 9bb2146acc5459e7d7f2e05108bbc8f68541eeab Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:14:07 -0400 Subject: [PATCH] Merge pull request #19242 from overleaf/em-api-error-handlers Handle more errors in the global API error handler GitOrigin-RevId: add31e2de067e8534f2eb3932623c2413c4ce6d8 --- services/web/app/src/Features/Errors/ErrorController.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/web/app/src/Features/Errors/ErrorController.js b/services/web/app/src/Features/Errors/ErrorController.js index 989d76861d..4b4bc9a5dd 100644 --- a/services/web/app/src/Features/Errors/ErrorController.js +++ b/services/web/app/src/Features/Errors/ErrorController.js @@ -100,6 +100,12 @@ function handleApiError(err, req, res, next) { ) { req.logger.setLevel('warn') res.sendStatus(400) + } else if (err instanceof Errors.TooManyRequestsError) { + req.logger.setLevel('warn') + res.sendStatus(429) + } else if (err instanceof Errors.ForbiddenError) { + req.logger.setLevel('warn') + res.sendStatus(403) } else { req.logger.setLevel('error') res.sendStatus(500)