Give better error message when rebuildPad.js hits a non-existing rev.

pull/2797/head
Robin Schneider 2015-10-07 12:42:19 +02:00
parent a09044a6f3
commit c9924ee706
No known key found for this signature in database
GPG Key ID: 489A4D5EC353C98A
1 changed files with 3 additions and 0 deletions

View File

@ -79,6 +79,9 @@ async.series([
newPad.pool.numToAttrib = oldPad.pool.numToAttrib;
for(var curRevNum = 0; curRevNum <= newRevHead; curRevNum++) {
db.db.get("pad:" + padId + ":revs:" + curRevNum, function(err, rev) {
if (rev.meta) {
throw "The specified revision number could not be found.";
}
var newRevNum = ++newPad.head;
var newRevId = "pad:" + newPad.id + ":revs:" + newRevNum;
db.db.set(newRevId, rev);