From 4a781bd0dd8828ce152f6ab2c3f1bbd6b5e826f7 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 9 Jan 2023 20:20:09 -0300
Subject: 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
---
 .../src/components/AmountField.stories.tsx                        | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/components/AmountField.stories.tsx')

diff --git a/packages/taler-wallet-webextension/src/components/AmountField.stories.tsx b/packages/taler-wallet-webextension/src/components/AmountField.stories.tsx
index 61c4a7661..f253d1996 100644
--- a/packages/taler-wallet-webextension/src/components/AmountField.stories.tsx
+++ b/packages/taler-wallet-webextension/src/components/AmountField.stories.tsx
@@ -20,12 +20,10 @@
  */
 
 import { AmountJson, Amounts } from "@gnu-taler/taler-util";
-import { styled } from "@linaria/react";
 import { Fragment, h, VNode } from "preact";
 import { useState } from "preact/hooks";
 import { useTranslationContext } from "../context/translation.js";
-import { Grid } from "../mui/Grid.js";
-import { AmountFieldHandler, TextFieldHandler } from "../mui/handlers.js";
+import { AmountFieldHandler, nullFunction, withSafe } from "../mui/handlers.js";
 import { AmountField } from "./AmountField.js";
 
 export default {
@@ -39,9 +37,9 @@ function RenderAmount(): VNode {
 
   const handler: AmountFieldHandler = {
     value: value ?? Amounts.zeroOfCurrency("USD"),
-    onInput: async (e) => {
+    onInput: withSafe(async (e) => {
       setValue(e);
-    },
+    }, nullFunction),
     error,
   };
   const { i18n } = useTranslationContext();
-- 
cgit v1.2.3

