commit d7acef9bde835ba673ad6f73ae0034daf222e83b
parent 054625d2bc67ede866b6a38342f3e4550cb95df2
Author: Florian Dold <florian@dold.me>
Date: Mon, 7 Apr 2025 21:44:38 +0200
wallet-core: use GANA EC
Diffstat:
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/packages/taler-util/src/errors.ts b/packages/taler-util/src/errors.ts
@@ -29,6 +29,7 @@ import {
PaymentInsufficientBalanceDetails,
TalerErrorCode,
TalerErrorDetail,
+ TransactionState,
TransactionType,
} from "@gnu-taler/taler-util";
@@ -181,6 +182,11 @@ export interface DetailsMap {
[TalerErrorCode.WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT]: {
detail?: string;
};
+ [TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED]: {
+ message?: string;
+ txState: TransactionState;
+ debugStateNum?: number;
+ };
}
type ErrBody<Y> = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;
diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts
@@ -4529,6 +4529,14 @@ export enum TalerErrorCode {
/**
+ * The wallet is not able to process the request due to the transaction's state.
+ * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED = 7046,
+
+
+ /**
* We encountered a timeout with our payment backend.
* Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).
* (A value of 0 indicates that the error is generated client-side).
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
@@ -3858,8 +3858,13 @@ export async function confirmWithdrawal(
return TransitionResult.transition(rec);
}
default: {
- throw Error(
- `unable to confirm withdrawal in current state: ${rec.status}`,
+ throw TalerError.fromDetail(
+ TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED,
+ {
+ message: `unable to confirm withdrawal in current state`,
+ txState: computeWithdrawalTransactionStatus(rec),
+ debugStateNum: rec.status,
+ },
);
}
}