aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
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-webextension/src/cta/Withdraw.tsx
parentf8d12f7b0d4af1b1769b89e80c87f9c169678564 (diff)
downloadwallet-core-5d23eb36354d07508a015531f298b3e261bbafce.tar.xz
wallet: improve error handling and error codes
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Withdraw.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index 66c83cf15..d58e2ec80 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -25,10 +25,8 @@ import {
AmountJson,
Amounts,
ExchangeListItem,
- Translate,
WithdrawUriInfoResponse,
} from "@gnu-taler/taler-util";
-import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../components/Loading";
@@ -52,6 +50,7 @@ import {
import * as wxApi from "../wxApi";
import { TermsOfServiceSection } from "./TermsOfServiceSection";
import { useTranslationContext } from "../context/translation";
+import { TalerError } from "@gnu-taler/taler-wallet-core";
interface Props {
talerWithdrawUri?: string;
@@ -85,9 +84,9 @@ export function View({
reviewed,
}: ViewProps): VNode {
const { i18n } = useTranslationContext();
- const [withdrawError, setWithdrawError] = useState<
- OperationFailedError | undefined
- >(undefined);
+ const [withdrawError, setWithdrawError] = useState<TalerError | undefined>(
+ undefined,
+ );
const [confirmDisabled, setConfirmDisabled] = useState<boolean>(false);
const needsReview = terms.status === "changed" || terms.status === "new";
@@ -109,7 +108,7 @@ export function View({
setConfirmDisabled(true);
await onWithdraw();
} catch (e) {
- if (e instanceof OperationFailedError) {
+ if (e instanceof TalerError) {
setWithdrawError(e);
}
setConfirmDisabled(false);
@@ -130,7 +129,7 @@ export function View({
Could not finish the withdrawal operation
</i18n.Translate>
}
- error={withdrawError.operationError}
+ error={withdrawError.errorDetail}
/>
)}