mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 04:34:42 +00:00
Merge pull request #2208 from overleaf/ta-handle-express-uri-error
Handle Express URIError GitOrigin-RevId: 6f22110971c8bdb1a7a2e5ba7043c37348b9092e
This commit is contained in:
parent
6c005da303
commit
b050de1645
1 changed files with 13 additions and 0 deletions
|
@ -30,6 +30,13 @@ module.exports = ErrorController = {
|
|||
} else if (error instanceof Errors.NotFoundError) {
|
||||
logger.warn({ err: error, url: req.url }, 'not found error')
|
||||
ErrorController.notFound(req, res)
|
||||
} else if (
|
||||
error instanceof URIError &&
|
||||
error.message.match(/^Failed to decode param/)
|
||||
) {
|
||||
logger.warn({ err: error, url: req.url }, 'Express URIError')
|
||||
res.status(400)
|
||||
res.render('general/500', { title: 'Invalid Error' })
|
||||
} else if (error instanceof Errors.ForbiddenError) {
|
||||
logger.error({ err: error }, 'forbidden error')
|
||||
ErrorController.forbidden(req, res)
|
||||
|
@ -64,6 +71,12 @@ module.exports = ErrorController = {
|
|||
if (error instanceof Errors.NotFoundError) {
|
||||
logger.warn({ err: error, url: req.url }, 'not found error')
|
||||
res.sendStatus(404)
|
||||
} else if (
|
||||
error instanceof URIError &&
|
||||
error.message.match(/^Failed to decode param/)
|
||||
) {
|
||||
logger.warn({ err: error, url: req.url }, 'Express URIError')
|
||||
res.sendStatus(400)
|
||||
} else {
|
||||
logger.error(
|
||||
{ err: error, url: req.url, method: req.method },
|
||||
|
|
Loading…
Reference in a new issue