Always include server response in Zotero.HTTP.request() errors

This commit is contained in:
Dan Stillman 2017-04-07 22:34:19 -04:00
parent 3df66ccbe4
commit a64c6808e5

View File

@ -252,10 +252,8 @@ Zotero.HTTP = new function() {
} }
deferred.resolve(xmlhttp); deferred.resolve(xmlhttp);
} else { } else {
let msg = "HTTP " + method + " " + dispURL + " failed with status code " + xmlhttp.status; let msg = "HTTP " + method + " " + dispURL + " failed with status code " + xmlhttp.status
if (xmlhttp.status == 400 || options.debug) { + ":\n\n" + xmlhttp.responseText;
msg += ":\n\n" + xmlhttp.responseText;
}
Zotero.debug(msg, 1); Zotero.debug(msg, 1);
deferred.reject(new Zotero.HTTP.UnexpectedStatusException(xmlhttp, msg)); deferred.reject(new Zotero.HTTP.UnexpectedStatusException(xmlhttp, msg));
} }