diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js index 9d36220ef0..af489bf59d 100644 --- a/chrome/content/zotero/xpcom/utilities_translate.js +++ b/chrome/content/zotero/xpcom/utilities_translate.js @@ -326,6 +326,11 @@ Zotero.Utilities.Translate.prototype.doGet = function(urls, processor, done, res translate.incrementAsyncProcesses("Zotero.Utilities.Translate#doGet"); var xmlhttp = Zotero.HTTP.doGet(url, function(xmlhttp) { + if (xmlhttp.status >= 400) { + translate.complete(false, `HTTP GET ${url} failed with status code ${xmlhttp.status}`); + return; + } + try { if(processor) { processor(xmlhttp.responseText, xmlhttp, url); @@ -355,6 +360,11 @@ Zotero.Utilities.Translate.prototype.doPost = function(url, body, onDone, header translate.incrementAsyncProcesses("Zotero.Utilities.Translate#doPost"); var xmlhttp = Zotero.HTTP.doPost(url, body, function(xmlhttp) { + if (xmlhttp.status >= 400) { + translate.complete(false, `HTTP POST ${url} failed with status code ${xmlhttp.status}`); + return; + } + try { onDone(xmlhttp.responseText, xmlhttp); translate.decrementAsyncProcesses("Zotero.Utilities.Translate#doPost");