Merge pull request #19242 from overleaf/em-api-error-handlers

Handle more errors in the global API error handler

GitOrigin-RevId: add31e2de067e8534f2eb3932623c2413c4ce6d8
This commit is contained in:
Eric Mc Sween 2024-07-03 11:14:07 -04:00 committed by Copybot
parent 898f6c81c8
commit 194d778c28

View file

@ -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)