taler-typescript-core

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

commit a9892b9e8c6c5b38b7383aee2a8089c376a115ce
parent 1c269d94a9e4af3a899363d17fd1363e2fa36881
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 02:54:41 +0200

util: give unexpected-response errors a concrete error code

Diffstat:
Mpackages/taler-util/src/operation.ts | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/operation.ts b/packages/taler-util/src/operation.ts @@ -288,12 +288,13 @@ export function succeedOrThrow<R>(result: OperationResult<R, unknown>): R { if (isOperationFail(result)) { const resp = result.response; throw TalerError.fromUncheckedDetail({ + code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR, case: result.case, requestUrl: resp.requestUrl, requestMethod: resp.requestMethod, httpStatusCode: resp.status, errorResponse: result.detail, - } as any); + }); } throw TalerError.fromException(result); } @@ -303,12 +304,13 @@ export function throwUnexpectedResponse( ): never { const resp = result.response; throw TalerError.fromUncheckedDetail({ + code: TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR, case: result.case, requestUrl: resp.requestUrl, requestMethod: resp.requestMethod, httpStatusCode: resp.status, errorResponse: "detail" in result ? result.detail : undefined, - } as any); + }); } /**