Skip to content

Commit ca16ec7

Browse files
committed
[MNY-275] Surface the error from bridge API in SwapWidget UI (#8277)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## 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}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b1a7808 commit ca16ec7

File tree

1 file changed

+2
-1
lines changed
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget

1 file changed

+2
-1
lines changed

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,14 @@ export function SwapUI(props: SwapUIProps) {
399399
<Text
400400
size="sm"
401401
color="danger"
402+
multiline
402403
center
403404
style={{
404405
paddingBlock: spacing.md,
405406
}}
406407
>
407408
{preparedResultQuery.error
408-
? "Failed to get a quote"
409+
? preparedResultQuery.error.message || "Failed to get a quote"
409410
: buyTokenQuery.isError
410411
? "Failed to fetch buy token details"
411412
: sellTokenQuery.isError

0 commit comments

Comments
 (0)