Skip to content

Commit

Permalink
Actually show an error when the revive request fails instead of showi…
Browse files Browse the repository at this point in the history
…ng the success message.
  • Loading branch information
DeKleineKobini committed Jan 5, 2025
1 parent fa2ed8d commit 3499392
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"features": [],
"fixes": [
{ "message": "Correctly count the supply pack value.", "contributor": "DeKleineKobini" },
{ "message": "Avoid an error on the item market when switching categories.", "contributor": "DeKleineKobini" }
{ "message": "Avoid an error on the item market when switching categories.", "contributor": "DeKleineKobini" },
{ "message": "Actually show an error when the revive request fails instead of showing the success message.", "contributor": "DeKleineKobini" }
],
"changes": [{ "message": "Better optimize calls to tornpal.", "contributor": "DeKleineKobini" }],
"removed": []
Expand Down
10 changes: 6 additions & 4 deletions extension/scripts/global/functions/api-external.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ function doRequestRevive(id, name, country, faction) {
const provider = REVIVE_PROVIDERS.find((p) => p.provider === providerName);
if (!provider) throw new Error(`Revive provider '${providerName}' not found.`);

return provider
.doRequest(id, name, country, faction, source)
.then(({ response, contract }) => ({ response, contract, provider }))
.catch((response) => ({ response, provider }));
return new Promise((resolve, reject) => {
provider
.doRequest(id, name, country, faction, source)
.then(({ response, contract }) => resolve({ response, contract, provider }))
.catch((response) => reject({ response, provider }));
});
}

function calculateRevivePrice({ price }) {
Expand Down

0 comments on commit 3499392

Please sign in to comment.