From ca16ec783bc63dae9ac0466a2de9641878433adf Mon Sep 17 00:00:00 2001 From: MananTank Date: Sat, 18 Oct 2025 00:05:28 +0000 Subject: [PATCH] [MNY-275] Surface the error from bridge API in SwapWidget UI (#8277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on improving error handling in the `swap-ui.tsx` component by providing more detailed error messages when fetching data fails. ### Detailed summary - Added `multiline` property to a component. - Updated error message for `preparedResultQuery.error` to display the specific error message if available, falling back to "Failed to get a quote". - Retained existing error messages for `buyTokenQuery` and `sellTokenQuery`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit * **Bug Fixes** * Improved error display in the swap widget: error text now shows a more specific message when available, falls back to a generic failure message otherwise, and supports multiline wrapping so longer errors are fully visible to users. --- .../thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx b/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx index 41abf1945f9..a948c2eb493 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx @@ -399,13 +399,14 @@ export function SwapUI(props: SwapUIProps) { {preparedResultQuery.error - ? "Failed to get a quote" + ? preparedResultQuery.error.message || "Failed to get a quote" : buyTokenQuery.isError ? "Failed to fetch buy token details" : sellTokenQuery.isError