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.
This commit is contained in:
parent
198fb28e20
commit
7b0ed6da81
3 changed files with 3 additions and 5 deletions
|
@ -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'),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue