taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit f119f4aae40623bb0c15f61f58a65a40ce233eab
parent c47cdeea31176532484c754a0897f02ffb64f28f
Author: Florian Dold <florian@dold.me>
Date:   Tue, 14 Jan 2025 23:40:43 +0100

wallet-core: use proper GANA error code when ToS download fails

Diffstat:
Mpackages/taler-wallet-core/src/exchanges.ts | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts @@ -221,6 +221,18 @@ async function downloadExchangeWithTermsOfService( timeout, cancellationToken: wex.cancellationToken, }); + + if ( + (resp.status >= 500 && resp.status <= 599) || + (resp.status >= 400 && resp.status >= 499) + ) { + const innerError = await readTalerErrorResponse(resp); + throw TalerError.fromDetail(TalerErrorCode.WALLET_EXCHANGE_UNAVAILABLE, { + exchangeBaseUrl, + innerError, + }); + } + const tosText = await readSuccessResponseTextOrThrow(resp); const tosEtag = resp.headers.get("taler-terms-version") || "unknown"; const tosContentLanguage = resp.headers.get("content-language") || undefined;