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
|
@ -51,9 +51,7 @@ Zotero_Preferences.Sync = {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// API key wrong/invalid
|
// API key wrong/invalid
|
||||||
if (!(e instanceof Zotero.HTTP.UnexpectedStatusException)
|
if (e instanceof Zotero.Error && e.error == Zotero.Error.ERROR_API_KEY_INVALID) {
|
||||||
&& !(e instanceof Zotero.HTTP.TimeoutException)
|
|
||||||
&& !(e instanceof Zotero.HTTP.BrowserOfflineException)) {
|
|
||||||
Zotero.alert(
|
Zotero.alert(
|
||||||
window,
|
window,
|
||||||
Zotero.getString('general.error'),
|
Zotero.getString('general.error'),
|
||||||
|
|
|
@ -55,7 +55,7 @@ Zotero.Sync.APIClient.prototype = {
|
||||||
Object.assign(opts, options);
|
Object.assign(opts, options);
|
||||||
opts.successCodes = [200, 403, 404];
|
opts.successCodes = [200, 403, 404];
|
||||||
var xmlhttp = yield this.makeRequest("GET", uri, opts);
|
var xmlhttp = yield this.makeRequest("GET", uri, opts);
|
||||||
if (xmlhttp.status == 403 || xmlhttp.status == 404) {
|
if (xmlhttp.status == 403) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var json = this._parseJSON(xmlhttp.responseText);
|
var json = this._parseJSON(xmlhttp.responseText);
|
||||||
|
|
|
@ -269,7 +269,7 @@ Zotero.Sync.Runner_Module = function (options = {}) {
|
||||||
var json = yield client.getKeyInfo(options);
|
var json = yield client.getKeyInfo(options);
|
||||||
Zotero.debug(json);
|
Zotero.debug(json);
|
||||||
if (!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
|
// Sanity check
|
||||||
|
|
Loading…
Reference in New Issue
Block a user