Merge pull request #2988 from overleaf/msm-oerror-remove-not-found-error

Replace HTTPErrors.NotFoundError with calls to notFound() handler

GitOrigin-RevId: c98582a5bd3d862b3c17fb03d863c75f64851aba
This commit is contained in:
Miguel Serrano
2020-07-16 16:55:05 +02:00
committed by Copybot
parent 63503f2079
commit 244709df5e
7 changed files with 92 additions and 42 deletions

View File

@@ -39,6 +39,18 @@ module.exports = {
}
},
notFound(req, res, message = 'not found', info = {}) {
res.status(404)
switch (req.accepts(['html', 'json'])) {
case 'html':
return res.render('general/404', { title: 'page_not_found' })
case 'json':
return renderJSONError(res, message, info)
default:
return res.send('not found')
}
},
unprocessableEntity(req, res, message = 'unprocessable entity', info = {}) {
res.status(422)
switch (req.accepts(['html', 'json'])) {