From b9e449200189dae302a71dac6af5974e080f9ea4 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 6 Mar 2017 19:05:11 +0000 Subject: [PATCH] Wrap RangeTracker in try catch --- services/document-updater/app/coffee/RangesManager.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/document-updater/app/coffee/RangesManager.coffee b/services/document-updater/app/coffee/RangesManager.coffee index c5aaf97473..7f430f476b 100644 --- a/services/document-updater/app/coffee/RangesManager.coffee +++ b/services/document-updater/app/coffee/RangesManager.coffee @@ -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")