taler-typescript-core

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

commit c3aef070dc7df345bbd9adb54049ec5a2ab964dc
parent 2a35a6f608ff278dc2618bb62688fff38d855be1
Author: Florian Dold <florian@dold.me>
Date:   Wed, 20 May 2026 15:33:15 +0200

embedded: wrap network error in TalerError before re-throwing

Diffstat:
Mpackages/taler-util/src/http-impl.qtart.ts | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/packages/taler-util/src/http-impl.qtart.ts b/packages/taler-util/src/http-impl.qtart.ts @@ -173,7 +173,25 @@ export class HttpLibImpl implements HttpRequestLibrary { `Request timed out (timeout ${opt?.timeout?.d_ms ?? "none"})`, ); } - throw e; + if ( + e != null && + typeof e === "object" && + "message" in e && + typeof e.message === "string" + ) { + throw TalerError.fromDetail( + TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, + { + requestUrl: url, + requestMethod: method, + httpStatusCode: 0, + }, + e.message, + ); + } else { + // Something weird/unexpected got thrown as exception, re-throw. + throw e; + } } if (logger.shouldLogTrace()) {