diff options
author | Sebastian <sebasjm@gmail.com> | 2023-01-09 20:20:09 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-01-09 20:20:09 -0300 |
commit | 4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7 (patch) | |
tree | 5c16976f99eb973ff62d78ed64107ca01df57b99 /packages/taler-wallet-webextension/src/wallet/History.tsx | |
parent | 8a70edb2f8e235c3462127b0aa4e1b65aa1aee0b (diff) | |
download | wallet-core-4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7.tar.xz |
fix #7153: more error handling
if handler do not trap error then fail at compile time,
all safe handlers push alert on error
errors are typed so they render good information
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/History.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/History.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index 143d3adbb..1d51f835a 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -23,7 +23,7 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; -import { AlertView } from "../components/CurrentAlerts.js"; +import { ErrorAlertView } from "../components/CurrentAlerts.js"; import { Loading } from "../components/Loading.js"; import { CenteredBoldText, @@ -33,7 +33,7 @@ import { } from "../components/styled/index.js"; import { Time } from "../components/Time.js"; import { TransactionItem } from "../components/TransactionItem.js"; -import { alertFromError } from "../context/alert.js"; +import { alertFromError, useAlertContext } from "../context/alert.js"; import { useBackendContext } from "../context/backend.js"; import { useTranslationContext } from "../context/translation.js"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; @@ -72,8 +72,8 @@ export function HistoryPage({ if (state.hasError) { return ( - <AlertView - alert={alertFromError( + <ErrorAlertView + error={alertFromError( i18n.str`Could not load the list of transactions`, state, )} @@ -112,6 +112,7 @@ export function HistoryView({ }): VNode { const { i18n } = useTranslationContext(); const currencies = balances.map((b) => b.available.split(":")[0]); + const { pushAlertOnError } = useAlertContext(); const defaultCurrencyIndex = currencies.findIndex( (c) => c === defaultCurrency, @@ -145,7 +146,7 @@ export function HistoryView({ return ( <NoBalanceHelp goToWalletManualWithdraw={{ - onClick: goToWalletManualWithdraw, + onClick: pushAlertOnError(goToWalletManualWithdraw), }} /> ); |