From 0abee38a56a114bab4ac1a6ce98c91ff533aa765 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 1 Jul 2024 10:34:32 -0500 Subject: [PATCH] Display proper swap error --- src/routes/SwapLightning.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/routes/SwapLightning.tsx b/src/routes/SwapLightning.tsx index ef0df62a..87845104 100644 --- a/src/routes/SwapLightning.tsx +++ b/src/routes/SwapLightning.tsx @@ -119,7 +119,7 @@ export function SwapLightning() { return feeSats() !== 0n; }); - const [feeEstimateWarning, setFeeEstimateWarning] = createSignal(); + const [feeEstimateWarning, setFeeEstimateWarning] = createSignal(); const feeEstimate = async () => { try { @@ -146,7 +146,14 @@ export function SwapLightning() { setStage("preview"); } catch (e) { console.error(e); - setFeeEstimateWarning(i18n.t("swap_lightning.too_small")); + const err = eify(e); + if (err.message === "Satoshi amount is invalid") { + setFeeEstimateWarning( + new Error(i18n.t("swap_lightning.too_small")) + ); + } else { + setFeeEstimateWarning(err); + } } finally { setLoading(false); } @@ -256,7 +263,7 @@ export function SwapLightning() { - {feeEstimateWarning()} + {feeEstimateWarning()?.message}