From ca1f1dc94483ebe903a3aec22762ff9006bcd23f Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 12 Jan 2016 09:26:29 +0000 Subject: [PATCH] handle exception in parsing retrieved json from aws --- services/track-changes/app/coffee/MongoAWS.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/track-changes/app/coffee/MongoAWS.coffee b/services/track-changes/app/coffee/MongoAWS.coffee index 15053f9766..e4cc3197ef 100644 --- a/services/track-changes/app/coffee/MongoAWS.coffee +++ b/services/track-changes/app/coffee/MongoAWS.coffee @@ -74,8 +74,11 @@ module.exports = MongoAWS = inputStream.on 'data', (line) -> if line.length > 2 - ops.push(JSON.parse(line)) - sz += line.length + try + ops.push(JSON.parse(line)) + catch err + return callback(err) + sz += line.length if ops.length >= MongoAWS.MAX_COUNT || sz >= MongoAWS.MAX_SIZE inputStream.pause() MongoAWS.handleBulk ops.slice(0), sz, () ->