mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-28 23:22:35 +00:00
Tighten up error handling.
This commit is contained in:
parent
fcfc595c35
commit
0d450b4e33
2 changed files with 8 additions and 1 deletions
|
@ -46,6 +46,9 @@ module.exports = FileController =
|
|||
{key, bucket} = req
|
||||
logger.log key:key, bucket:bucket, "reciving request to insert file"
|
||||
FileHandler.insertFile bucket, key, req, (err)->
|
||||
if err?
|
||||
logger.log err: err, key: key, bucket: bucket, "error inserting file"
|
||||
res.send 500
|
||||
res.send 200
|
||||
|
||||
copyFile: (req, res)->
|
||||
|
|
|
@ -38,6 +38,8 @@ module.exports =
|
|||
_getConvertedFile: (bucket, key, opts, callback)->
|
||||
convetedKey = KeyBuilder.addCachingToKey(key, opts)
|
||||
PersistorManager.checkIfFileExists bucket, convetedKey, (err, exists)=>
|
||||
if err?
|
||||
return callback(err)
|
||||
if exists
|
||||
PersistorManager.getFileStream bucket, convetedKey, opts, callback
|
||||
else
|
||||
|
@ -62,6 +64,8 @@ module.exports =
|
|||
|
||||
_convertFile: (bucket, origonalKey, opts, callback)->
|
||||
@_writeS3FileToDisk bucket, origonalKey, opts, (err, origonalFsPath)->
|
||||
if err?
|
||||
return callback(err)
|
||||
done = (err, destPath)->
|
||||
if err?
|
||||
logger.err err:err, bucket:bucket, origonalKey:origonalKey, opts:opts, "error converting file"
|
||||
|
@ -76,7 +80,7 @@ module.exports =
|
|||
else if opts.style == "preview"
|
||||
FileConverter.preview origonalFsPath, done
|
||||
else
|
||||
throw new Error("should have specified opts to convert file with #{JSON.stringify(opts)}")
|
||||
return callback(new Error("should have specified opts to convert file with #{JSON.stringify(opts)}"))
|
||||
|
||||
|
||||
_writeS3FileToDisk: (bucket, key, opts, callback)->
|
||||
|
|
Loading…
Reference in a new issue