handle exception in parsing retrieved json from aws

This commit is contained in:
Brian Gough 2016-01-12 09:26:29 +00:00
parent b8862ca5af
commit ca1f1dc944

View file

@ -74,7 +74,10 @@ module.exports = MongoAWS =
inputStream.on 'data', (line) -> inputStream.on 'data', (line) ->
if line.length > 2 if line.length > 2
try
ops.push(JSON.parse(line)) ops.push(JSON.parse(line))
catch err
return callback(err)
sz += line.length sz += line.length
if ops.length >= MongoAWS.MAX_COUNT || sz >= MongoAWS.MAX_SIZE if ops.length >= MongoAWS.MAX_COUNT || sz >= MongoAWS.MAX_SIZE
inputStream.pause() inputStream.pause()