mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
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:
parent
898f6c81c8
commit
194d778c28
1 changed files with 6 additions and 0 deletions
|
@ -100,6 +100,12 @@ function handleApiError(err, req, res, next) {
|
||||||
) {
|
) {
|
||||||
req.logger.setLevel('warn')
|
req.logger.setLevel('warn')
|
||||||
res.sendStatus(400)
|
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 {
|
} else {
|
||||||
req.logger.setLevel('error')
|
req.logger.setLevel('error')
|
||||||
res.sendStatus(500)
|
res.sendStatus(500)
|
||||||
|
|
Loading…
Reference in a new issue