mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 10:31:31 +00:00
add error handler to each stage of upload pipeline
This commit is contained in:
parent
1c1b1d9595
commit
d9085a5e5e
1 changed files with 13 additions and 4 deletions
|
@ -10,7 +10,12 @@ module.exports = MongoAWS =
|
||||||
|
|
||||||
bulkLimit: 10
|
bulkLimit: 10
|
||||||
|
|
||||||
archiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
|
archiveDocHistory: (project_id, doc_id, _callback = (error) ->) ->
|
||||||
|
|
||||||
|
callback = (args...) ->
|
||||||
|
_callback(args...)
|
||||||
|
_callback = () ->
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
doc_id: ObjectId(doc_id)
|
doc_id: ObjectId(doc_id)
|
||||||
expiresAt: {$exists : false}
|
expiresAt: {$exists : false}
|
||||||
|
@ -27,10 +32,14 @@ module.exports = MongoAWS =
|
||||||
}
|
}
|
||||||
|
|
||||||
db.docHistory.find(query)
|
db.docHistory.find(query)
|
||||||
|
.on 'error', (err) ->
|
||||||
|
callback(err)
|
||||||
.pipe JSONStream.stringify()
|
.pipe JSONStream.stringify()
|
||||||
.pipe upload
|
.pipe upload
|
||||||
.on 'finish', () ->
|
.on 'error', (err) ->
|
||||||
return callback(null)
|
callback(err)
|
||||||
|
.on 'finish', () ->
|
||||||
|
return callback(null)
|
||||||
|
|
||||||
unArchiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
|
unArchiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue