Fix 412 handling

This commit is contained in:
Dan Stillman 2015-11-02 03:20:29 -05:00
parent 7f43ca9503
commit e03cf637b6

View file

@ -604,18 +604,26 @@ Zotero.Sync.Data.Engine.prototype._startUpload = Zotero.Promise.coroutine(functi
return this.UPLOAD_RESULT_NOTHING_TO_UPLOAD;
}
Zotero.debug(JSON.stringify(objectIDs));
for (let objectType in objectIDs) {
libraryVersion = yield this._uploadObjects(
objectType, objectIDs[objectType], libraryVersion
);
try {
Zotero.debug(JSON.stringify(objectIDs));
for (let objectType in objectIDs) {
libraryVersion = yield this._uploadObjects(
objectType, objectIDs[objectType], libraryVersion
);
}
Zotero.debug(JSON.stringify(objectDeletions));
for (let objectType in objectDeletions) {
libraryVersion = yield this._uploadDeletions(
objectType, objectDeletions[objectType], libraryVersion
);
}
}
Zotero.debug(JSON.stringify(objectDeletions));
for (let objectType in objectDeletions) {
libraryVersion = yield this._uploadDeletions(
objectType, objectDeletions[objectType], libraryVersion
);
catch (e) {
if (e instanceof Zotero.HTTP.UnexpectedStatusException && e.status == 412) {
return this.UPLOAD_RESULT_LIBRARY_CONFLICT;
}
throw e;
}
return this.UPLOAD_RESULT_SUCCESS;
@ -776,7 +784,7 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func
catch (e) {
if (e instanceof Zotero.HTTP.UnexpectedStatusException) {
if (e.status == 412) {
return this.UPLOAD_RESULT_LIBRARY_CONFLICT;
throw e;
}
// On 5xx, delay and retry
@ -838,7 +846,7 @@ Zotero.Sync.Data.Engine.prototype._uploadDeletions = Zotero.Promise.coroutine(fu
catch (e) {
if (e instanceof Zotero.HTTP.UnexpectedStatusException) {
if (e.status == 412) {
return this.UPLOAD_RESULT_LIBRARY_CONFLICT;
throw e;
}
// On 5xx, delay and retry