aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts23
1 files changed, 20 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 1cb051365..649621948 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -45,12 +45,14 @@ import {
TrackDepositGroupResponse,
TransactionType,
URL,
+ TalerErrorCode,
} from "@gnu-taler/taler-util";
import {
DenominationRecord,
DepositGroupRecord,
OperationStatus,
} from "../db.js";
+import { TalerError } from "../errors.js";
import { InternalWalletState } from "../internal-wallet-state.js";
import { readSuccessResponseJsonOrThrow } from "../util/http.js";
import { OperationAttemptResult } from "../util/retries.js";
@@ -269,7 +271,12 @@ export async function getFeeForDeposit(
});
if (payCoinSel.type !== "success") {
- throw Error("insufficient funds");
+ throw TalerError.fromDetail(
+ TalerErrorCode.WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE,
+ {
+ insufficientBalanceDetails: payCoinSel.insufficientBalanceDetails,
+ },
+ );
}
return await getTotalFeesForDepositAmount(
@@ -356,7 +363,12 @@ export async function prepareDepositGroup(
});
if (payCoinSel.type !== "success") {
- throw Error("insufficient funds");
+ throw TalerError.fromDetail(
+ TalerErrorCode.WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE,
+ {
+ insufficientBalanceDetails: payCoinSel.insufficientBalanceDetails,
+ },
+ );
}
const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel.coinSel);
@@ -453,7 +465,12 @@ export async function createDepositGroup(
});
if (payCoinSel.type !== "success") {
- throw Error("insufficient funds");
+ throw TalerError.fromDetail(
+ TalerErrorCode.WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE,
+ {
+ insufficientBalanceDetails: payCoinSel.insufficientBalanceDetails,
+ },
+ );
}
const totalDepositCost = await getTotalPaymentCost(ws, payCoinSel.coinSel);