www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7b0ed6da8167873a8f67a5d36fad30be99e6539f
parent 198fb28e20250447f68e9c65858ac8eb0289ff62
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  5 Aug 2017 01:07:49 +0200

Don't unlink account on key info request connection failure

This can happen when the computer is offline but that hasn't been
detected for some reason.

Diffstat:
Mchrome/content/zotero/preferences/preferences_sync.js | 4+---
Mchrome/content/zotero/xpcom/sync/syncAPIClient.js | 2+-
Mchrome/content/zotero/xpcom/sync/syncRunner.js | 2+-
3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js @@ -51,9 +51,7 @@ Zotero_Preferences.Sync = { } catch (e) { // API key wrong/invalid - if (!(e instanceof Zotero.HTTP.UnexpectedStatusException) - && !(e instanceof Zotero.HTTP.TimeoutException) - && !(e instanceof Zotero.HTTP.BrowserOfflineException)) { + if (e instanceof Zotero.Error && e.error == Zotero.Error.ERROR_API_KEY_INVALID) { Zotero.alert( window, Zotero.getString('general.error'), diff --git a/chrome/content/zotero/xpcom/sync/syncAPIClient.js b/chrome/content/zotero/xpcom/sync/syncAPIClient.js @@ -55,7 +55,7 @@ Zotero.Sync.APIClient.prototype = { Object.assign(opts, options); opts.successCodes = [200, 403, 404]; var xmlhttp = yield this.makeRequest("GET", uri, opts); - if (xmlhttp.status == 403 || xmlhttp.status == 404) { + if (xmlhttp.status == 403) { return false; } var json = this._parseJSON(xmlhttp.responseText); diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -269,7 +269,7 @@ Zotero.Sync.Runner_Module = function (options = {}) { var json = yield client.getKeyInfo(options); Zotero.debug(json); if (!json) { - throw new Zotero.Error("API key not set", Zotero.Error.ERROR_API_KEY_NOT_SET); + throw new Zotero.Error("API key not set", Zotero.Error.ERROR_API_KEY_INVALID); } // Sanity check