aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-22 21:16:38 +0100
committerFlorian Dold <florian@dold.me>2022-03-22 21:16:38 +0100
commit5d23eb36354d07508a015531f298b3e261bbafce (patch)
treefae0d2599c94d88c9264bb63a301adb1706824c1 /packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
parentf8d12f7b0d4af1b1769b89e80c87f9c169678564 (diff)
downloadwallet-core-5d23eb36354d07508a015531f298b3e261bbafce.tar.xz
wallet: improve error handling and error codes
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts')
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
index f9c7c4b99..dc650830d 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
@@ -181,16 +181,22 @@ export async function runExchangeManagementTest(t: GlobalTestState) {
},
});
- const err1 = await t.assertThrowsOperationErrorAsync(async () => {
+ const err1 = await t.assertThrowsTalerErrorAsync(async () => {
await wallet.client.call(WalletApiOperation.AddExchange, {
exchangeBaseUrl: faultyExchange.baseUrl,
});
});
+ // Updating the exchange from the base URL is technically a pending operation
+ // and it will be retried later.
+ t.assertTrue(
+ err1.hasErrorCode(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED),
+ );
+
// Response is malformed, since it didn't even contain a version code
// in a format the wallet can understand.
t.assertTrue(
- err1.operationError.code ===
+ err1.errorDetail.innerError.code ===
TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
);
@@ -223,14 +229,18 @@ export async function runExchangeManagementTest(t: GlobalTestState) {
},
});
- const err2 = await t.assertThrowsOperationErrorAsync(async () => {
+ const err2 = await t.assertThrowsTalerErrorAsync(async () => {
await wallet.client.call(WalletApiOperation.AddExchange, {
exchangeBaseUrl: faultyExchange.baseUrl,
});
});
t.assertTrue(
- err2.operationError.code ===
+ err2.hasErrorCode(TalerErrorCode.WALLET_PENDING_OPERATION_FAILED),
+ );
+
+ t.assertTrue(
+ err2.errorDetail.innerError.code ===
TalerErrorCode.WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE,
);