Merge pull request #2530 from webzwo0i/exception-handling-for-mimatched-composition

do not crash when encountering mismatched compositions. log the changese...
This commit is contained in:
John McLear 2015-03-31 23:17:51 +01:00
commit b404af7c17
1 changed files with 9 additions and 4 deletions

View File

@ -1634,10 +1634,15 @@ function composePadChangesets(padId, startNum, endNum, callback)
changeset = changesets[startNum];
var pool = pad.apool();
for(var r=startNum+1;r<endNum;r++)
{
var cs = changesets[r];
changeset = Changeset.compose(changeset, cs, pool);
try {
for(var r=startNum+1;r<endNum;r++) {
var cs = changesets[r];
changeset = Changeset.compose(changeset, cs, pool);
}
} catch(e){
// r-1 indicates the rev that was build starting with startNum, applying startNum+1, +2, +3
console.warn("failed to compose cs in pad:",padId," startrev:",startNum," current rev:",r);
return callback(e);
}
callback(null);