Skip to content

Commit

Permalink
Do not throw in HTTP.request().then() handler for errors
Browse files Browse the repository at this point in the history
HTTP.doGet() and HTTP.doPost() are not async functions and the promise
from HTTP.request() is not awaited for, so any throws in the then()
handler are not handled anywhere. This is likely causing failures to
fallback to a different translator when a non-success response code is
received for a request from a translator in certain deployment
conditions.

Addresses #178
  • Loading branch information
adomasven committed Nov 29, 2024
1 parent 0a9199e commit dd03dc1
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ Zotero.HTTP = new function() {
this.request('GET', url, {responseCharset, headers, cookieSandbox})
.then(onDone, function(e) {
onDone({status: e.status, responseText: e.responseText});
throw (e);
});
return true;
};
Expand All @@ -308,7 +307,6 @@ Zotero.HTTP = new function() {
this.request('POST', url, {body, responseCharset, headers, cookieSandbox})
.then(onDone, function(e) {
onDone({status: e.status, responseText: e.responseText});
throw (e);
});
return true;
};
Expand Down

0 comments on commit dd03dc1

Please sign in to comment.