Fix handling of unexpected status code for repository update request

This commit is contained in:
Dan Stillman 2016-06-05 19:06:00 -04:00
parent 19714d5b9b
commit a2fbf04682

View File

@ -1052,15 +1052,16 @@ Zotero.Schema = new function(){
return _updateFromRepositoryCallback(xmlhttp, !!force); return _updateFromRepositoryCallback(xmlhttp, !!force);
} }
catch (e) { catch (e) {
if (e instanceof Zotero.HTTP.BrowserOfflineException || e.xmlhttp) { if (e instanceof Zotero.HTTP.UnexpectedStatusException
|| e instanceof Zotero.HTTP.BrowserOfflineException) {
let msg = " -- retrying in " + ZOTERO_CONFIG.REPOSITORY_RETRY_INTERVAL let msg = " -- retrying in " + ZOTERO_CONFIG.REPOSITORY_RETRY_INTERVAL
if (e instanceof Zotero.HTTP.BrowserOfflineException) { if (e instanceof Zotero.HTTP.BrowserOfflineException) {
Zotero.debug("Browser is offline" + msg, 2); Zotero.debug("Browser is offline" + msg, 2);
} }
else { else {
Components.utils.reportError(e); Zotero.logError(e);
Zotero.debug(xmlhttp.status, 1); Zotero.debug(e.status, 1);
Zotero.debug(xmlhttp.responseText, 1); Zotero.debug(e.xmlhttp.responseText, 1);
Zotero.debug("Error updating from repository " + msg, 1); Zotero.debug("Error updating from repository " + msg, 1);
} }
// TODO: instead, add an observer to start and stop timer on online state change // TODO: instead, add an observer to start and stop timer on online state change