Don't show error icon when file sync is cancelled

This commit is contained in:
Dan Stillman 2019-10-14 01:27:59 -04:00
parent 42d570e623
commit b4121ee6bc
3 changed files with 19 additions and 6 deletions

View file

@ -229,8 +229,13 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function*
succeeded++;
}
else if (!p.isPending()) {
let e = p.reason();
if (e instanceof Zotero.HTTP.CancelledException) {
Zotero.debug(`File ${type} sync cancelled for ${this.library.name} `
+ `(${succeeded} succeeded, ${failed} failed)`);
throw new Zotero.Sync.UserCancelledException();
}
if (this.stopOnError) {
let e = p.reason();
Zotero.debug(`File ${type} sync failed for ${this.library.name}`);
throw e;
}

View file

@ -751,11 +751,14 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
);
}
catch (e) {
let msg = `Unexpected file registration status ${e.status} (${item.libraryKey})`;
Zotero.logError(msg);
Zotero.logError(e.xmlhttp.responseText);
Zotero.debug(e.xmlhttp.getAllResponseHeaders());
throw new Error(Zotero.Sync.Storage.defaultError);
if (e instanceof Zotero.HTTP.UnexpectedStatusException) {
let msg = `Unexpected file registration status ${e.status} (${item.libraryKey})`;
Zotero.logError(msg);
Zotero.logError(e.xmlhttp.responseText);
Zotero.debug(e.xmlhttp.getAllResponseHeaders());
throw new Error(Zotero.Sync.Storage.defaultError);
}
throw e;
}
var version = req.getResponseHeader('Last-Modified-Version');

View file

@ -209,6 +209,11 @@ Zotero.Sync.Runner_Module = function (options = {}) {
setStatus: this.setSyncStatus.bind(this),
stopOnError,
onError: function (e) {
// Ignore cancelled requests
if (e instanceof Zotero.HTTP.CancelledException) {
Zotero.debug("Request was cancelled");
return;
}
if (options.onError) {
options.onError(e);
}