From 9d39012b49b0518ab6a0a17ac12f7707d7b8c7ae Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 16 Sep 2015 16:00:37 +0100 Subject: [PATCH] add error handler to each stage of download pipeline --- services/track-changes/app/coffee/MongoAWS.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/track-changes/app/coffee/MongoAWS.coffee b/services/track-changes/app/coffee/MongoAWS.coffee index 7fe90378c6..ca4914c733 100644 --- a/services/track-changes/app/coffee/MongoAWS.coffee +++ b/services/track-changes/app/coffee/MongoAWS.coffee @@ -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