Wrap RangeTracker in try catch

This commit is contained in:
James Allen 2017-03-06 19:05:11 +00:00
parent a3a9a726d8
commit b9e4492001

View file

@ -13,7 +13,10 @@ module.exports = RangesManager =
if !!update.meta.tc
rangesTracker.setIdSeed(update.meta.tc)
for op in update.op
rangesTracker.applyOp(op, { user_id: update.meta?.user_id })
try
rangesTracker.applyOp(op, { user_id: update.meta?.user_id })
catch error
return callback(error)
if rangesTracker.changes?.length > RangesManager.MAX_CHANGES or rangesTracker.comments?.length > RangesManager.MAX_COMMENTS
return callback new Error("too many comments or tracked changes")