wrap appendRevision in try-catch block

pull/2364/head
webzwo0i 2014-12-04 16:05:02 +01:00
parent 10c2f72720
commit 5306f0c98a
1 changed files with 10 additions and 1 deletions

View File

@ -742,7 +742,16 @@ function handleUserChanges(data, cb)
return callback(new Error("Can't apply USER_CHANGES "+changeset+" with oldLen " + Changeset.oldLen(changeset) + " to document of length " + prevText.length)); return callback(new Error("Can't apply USER_CHANGES "+changeset+" with oldLen " + Changeset.oldLen(changeset) + " to document of length " + prevText.length));
} }
pad.appendRevision(changeset, thisSession.author); try
{
pad.appendRevision(changeset, thisSession.author);
}
catch(e)
{
client.json.send({disconnect:"badChangeset"});
stats.meter('failedChangesets').mark();
return callback(e)
}
var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool); var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
if (correctionChangeset) { if (correctionChangeset) {