add error handler to each stage of download pipeline

This commit is contained in:
Brian Gough 2015-09-16 16:00:37 +01:00
parent d9085a5e5e
commit 9d39012b49

View file

@ -41,7 +41,11 @@ module.exports = MongoAWS =
.on 'finish', () ->
return callback(null)
unArchiveDocHistory: (project_id, doc_id, callback = (error) ->) ->
unArchiveDocHistory: (project_id, doc_id, _callback = (error) ->) ->
callback = (args...) ->
_callback(args...)
_callback = () ->
AWS.config.update {
accessKeyId: settings.filestore.s3.key
@ -61,6 +65,8 @@ module.exports = MongoAWS =
download
.on 'open', (obj) ->
return 1
.on 'error', (err) ->
callback(err)
.pipe lineStream
.on 'data', (line) ->
if line.length > 2