diff options
author | Florian Dold <florian@dold.me> | 2022-03-22 21:16:38 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-22 21:16:38 +0100 |
commit | 5d23eb36354d07508a015531f298b3e261bbafce (patch) | |
tree | fae0d2599c94d88c9264bb63a301adb1706824c1 /packages/taler-wallet-cli/src/harness | |
parent | f8d12f7b0d4af1b1769b89e80c87f9c169678564 (diff) | |
download | wallet-core-5d23eb36354d07508a015531f298b3e261bbafce.tar.xz |
wallet: improve error handling and error codes
Diffstat (limited to 'packages/taler-wallet-cli/src/harness')
-rw-r--r-- | packages/taler-wallet-cli/src/harness/harness.ts | 14 |
1 files changed, 7 insertions, 7 deletions
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<void>, - ): Promise<OperationFailedError> { + ): Promise<TalerError> { 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; }, |