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

@@ -1,4 +1,3 @@
const HttpErrors = require('@overleaf/o-error/http')
const ProjectDeleter = require('../Project/ProjectDeleter')
const EditorController = require('./EditorController')
const ProjectGetter = require('../Project/ProjectGetter')
@@ -269,9 +268,7 @@ async function convertDocToFile(req, res, next) {
res.json({ fileId: fileRef._id.toString() })
} catch (err) {
if (err instanceof Errors.NotFoundError) {
throw new HttpErrors.NotFoundError({
info: { public: { message: 'Document not found' } }
})
return HttpErrorHandler.notFound(req, res, 'Document not found')
} else if (err instanceof Errors.DocHasRangesError) {
return HttpErrorHandler.unprocessableEntity(
req,