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,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, () ->