Fix "Sync delete log starts after last sync date in Zotero.Sync.Server.sync()" error

This commit is contained in:
Dan Stillman 2009-07-06 10:20:04 +00:00
parent 41437738b0
commit 3341336232
2 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ Zotero.Error = function (message, error) {
Zotero.Error.ERROR_UNKNOWN = 0;
Zotero.Error.ERROR_MISSING_OBJECT = 1;
Zotero.Error.ERROR_FULL_SYNC_REQUIRED = 2;
Zotero.Error.prototype.toString = function () {
return this.message;

View File

@ -994,7 +994,9 @@ Zotero.Sync.Server = new function () {
var deleted = Zotero.Sync.getDeletedObjects(lastLocalSyncDate, syncSession.uploadKeys.deleted);
if (deleted == -1) {
_error('Sync delete log starts after last sync date in Zotero.Sync.Server.sync()');
var msg = "Sync delete log starts after last sync date in Zotero.Sync.Server.sync()";
var e = new Zotero.Error(msg, "FULL_SYNC_REQUIRED");
throw (e);
}
var nextLocalSyncDate = Zotero.DB.transactionDate;
@ -1680,6 +1682,7 @@ Zotero.Sync.Server = new function () {
if (e.name && e.name == 'ZOTERO_ERROR') {
switch (e.error) {
case Zotero.Error.ERROR_MISSING_OBJECT:
case Zotero.Error.ERROR_FULL_SYNC_REQUIRED:
// Let current sync fail, and then do a full sync
var background = Zotero.Sync.Runner.background;
setTimeout(function () {