From 5d23eb36354d07508a015531f298b3e261bbafce Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 22 Mar 2022 21:16:38 +0100 Subject: wallet: improve error handling and error codes --- packages/taler-wallet-cli/src/harness/harness.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/taler-wallet-cli/src/harness') diff --git a/packages/taler-wallet-cli/src/harness/harness.ts b/packages/taler-wallet-cli/src/harness/harness.ts index 63bb17fcc..46ddd0ed2 100644 --- a/packages/taler-wallet-cli/src/harness/harness.ts +++ b/packages/taler-wallet-cli/src/harness/harness.ts @@ -49,7 +49,7 @@ import { HarnessExchangeBankAccount, NodeHttpLib, openPromise, - OperationFailedError, + TalerError, WalletCoreApiClient, } from "@gnu-taler/taler-wallet-core"; import { @@ -227,19 +227,19 @@ export class GlobalTestState { this.servers = []; } - async assertThrowsOperationErrorAsync( + async assertThrowsTalerErrorAsync( block: () => Promise, - ): Promise { + ): Promise { try { await block(); } catch (e) { - if (e instanceof OperationFailedError) { + if (e instanceof TalerError) { return e; } - throw Error(`expected OperationFailedError to be thrown, but got ${e}`); + throw Error(`expected TalerError to be thrown, but got ${e}`); } throw Error( - `expected OperationFailedError to be thrown, but block finished without throwing`, + `expected TalerError to be thrown, but block finished without throwing`, ); } @@ -1904,7 +1904,7 @@ export class WalletCli { throw new Error("wallet CLI did not return a proper JSON response"); } if (ar.type === "error") { - throw new OperationFailedError(ar.error); + throw TalerError.fromUncheckedDetail(ar.error); } return ar.result; }, -- cgit v1.2.3