Skip to content

[SDK] Improve error handling in PayEmbed #7119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented May 22, 2025


PR-Codex overview

This PR focuses on improving error handling and messages within the thirdweb package, particularly in the PayEmbed component and throughout the bridge-related functionalities. It introduces a new ApiError class for more structured error management.

Detailed summary

  • Added better error messages in PayEmbed.
  • Introduced ApiError class in packages/thirdweb/src/bridge/types/Errors.ts.
  • Updated error handling to use ApiError in various files.
  • Renamed BridgeAction to Action in type definitions.
  • Enhanced error message formatting in SwapScreenContent and FiatScreenContent.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Bug Fixes
    • Improved error messages in PayEmbed and related wallet features with clearer, more detailed reporting.
    • Numeric values in the Pay With Credit Card screen now display with two decimal places for better readability.
    • Simplified error messages and UI in Fiat and Swap screens by removing minimum amount details and related controls.
  • New Features
    • Introduced structured error handling with detailed error codes and correlation IDs for enhanced troubleshooting across multiple wallet operations.

Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 4:48am
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 4:48am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 4:48am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 4:48am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 4:48am

Copy link

changeset-bot bot commented May 22, 2025

🦋 Changeset detected

Latest commit: f83cbd2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented May 22, 2025

## Walkthrough

This change introduces improved error handling for the "thirdweb" bridge modules by replacing generic error throws with a new structured `ApiError` class. The error reporting in various bridge-related functions now provides more detailed and consistent error information. Additionally, the number formatting in the PayWithCreditCard UI component was adjusted for better display precision. Some UI components related to error display for minimum amounts were simplified by removing conditional rendering and specialized buttons.

## Changes

| File(s)                                                                                  | Change Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `.changeset/blue-comics-doubt.md`                                                        | Documents the patch update, summarizing improvements to error messages in the PayEmbed functionality of the "thirdweb" component.                                                                                                                                                                                                                                                                                                                                                                 |
| `packages/thirdweb/src/bridge/Buy.ts`<br>`.../Sell.ts`<br>`.../Onramp.ts`<br>`.../Transfer.ts`<br>`.../Status.ts`<br>`.../OnrampStatus.ts`<br>`.../Chains.ts`<br>`.../Routes.ts` | Updated error handling in bridge-related functions to throw a new `ApiError` with structured properties (`code`, `message`, `correlationId`, `statusCode`) instead of generic `Error` objects. The thrown errors now contain richer, more consistent information extracted from the API response.                                                                                                                 |
| `packages/thirdweb/src/bridge/types/Errors.ts`                                           | Introduced new error type definitions: `ErrorCode` union type and `ApiError` class, which extends the built-in `Error` class and adds fields for code, correlation ID, and status code.                                                                                                                                                                                                                                                             |
| `packages/thirdweb/src/react/web/utils/errors.ts`                                        | Enhanced the `getErrorMessage` function to specifically handle `ApiError` instances, returning a structured `UiError` object with a cleaned-up message. Added a helper function to sanitize error messages from `ApiError`.                                                                                                                                    |
| `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx`     | Changed numeric display formatting in `PayWithCreditCard` component from 6 to 2 decimal places for improved value presentation.                                                                                                                                                                                                                                                                                                                           |
| `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx`| Removed conditional rendering of minimum amount error messages and "Set Minimum" button; simplified error display to a generic message and always render a single "Continue" button.                                                                                                                                                                                                                                                                |
| `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx`| Removed conditional rendering for minimum amount error messages and "Set Minimum" button; simplified error display to always show error title and message, and changed button logic to show "Pay with another token" only if error or insufficient balance.                                                                                                                                                                                        |
| `packages/thirdweb/src/bridge/Routes.test.ts`                                           | Updated test expectation for error message in invalid route request test to match new error message format without error code prefix.                                                                                                                                                                                                                                                                                                                  |
| `packages/thirdweb/src/bridge/index.ts`                                                 | Renamed export of type `BridgeAction` to `Action` and added export of the `ApiError` class from the `types/Errors` module.                                                                                                                                                                                                                                                                                                                             |
| `packages/thirdweb/src/bridge/types/BridgeAction.ts`                                    | Renamed exported type alias from `BridgeAction` to `Action` without changing the underlying union string literal values.                                                                                                                                                                                                                                                                                                                               |
| `packages/thirdweb/src/bridge/types/Route.ts`                                           | Updated import and type annotation for `action` property in `RouteTransaction` from `BridgeAction` to `Action`.                                                                                                                                                                                                                                                                                                                                          |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant UI
    participant BridgeModule
    participant API

    UI->>BridgeModule: Call bridge function (e.g., quote, prepare)
    BridgeModule->>API: Send HTTP request
    API-->>BridgeModule: Respond (success or error)
    alt Response is OK
        BridgeModule-->>UI: Return result
    else Response is Error
        BridgeModule->>ApiError: Construct with code, message, correlationId, statusCode
        BridgeModule-->>UI: Throw ApiError
    end
    UI->>getErrorMessage: Handle error
    getErrorMessage-->>UI: Return structured UiError

Suggested reviewers

  • MananTank

<!-- walkthrough_end -->

<!-- This is an auto-generated comment: resource warnings by coderabbit.ai -->

> [!WARNING]
> ## Review ran into problems
> 
> <details>
> <summary>🔥 Problems</summary>
> 
> Errors were encountered while retrieving linked issues.
> 
> <details>
> <summary>Errors (1)</summary>
> 
> * TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
> 
> </details>
> 
> </details>

<!-- end of auto-generated comment: resource warnings by coderabbit.ai -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e5f406d9d0f77c9df315d175e8b83d6f1bc90ce9 and f83cbd26b2a92c6e9d5fd4b1b11ee5fa3f5524b9.

</details>

<details>
<summary>📒 Files selected for processing (18)</summary>

* `.changeset/blue-comics-doubt.md` (1 hunks)
* `packages/thirdweb/src/bridge/Buy.ts` (3 hunks)
* `packages/thirdweb/src/bridge/Chains.ts` (2 hunks)
* `packages/thirdweb/src/bridge/Onramp.ts` (2 hunks)
* `packages/thirdweb/src/bridge/OnrampStatus.ts` (2 hunks)
* `packages/thirdweb/src/bridge/Routes.test.ts` (1 hunks)
* `packages/thirdweb/src/bridge/Routes.ts` (2 hunks)
* `packages/thirdweb/src/bridge/Sell.ts` (3 hunks)
* `packages/thirdweb/src/bridge/Status.ts` (2 hunks)
* `packages/thirdweb/src/bridge/Transfer.ts` (2 hunks)
* `packages/thirdweb/src/bridge/index.ts` (1 hunks)
* `packages/thirdweb/src/bridge/types/BridgeAction.ts` (1 hunks)
* `packages/thirdweb/src/bridge/types/Errors.ts` (1 hunks)
* `packages/thirdweb/src/bridge/types/Route.ts` (2 hunks)
* `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx` (1 hunks)
* `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx` (1 hunks)
* `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx` (2 hunks)
* `packages/thirdweb/src/react/web/utils/errors.ts` (2 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* packages/thirdweb/src/bridge/Routes.test.ts

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (15)</summary>

* packages/thirdweb/src/bridge/types/BridgeAction.ts
* .changeset/blue-comics-doubt.md
* packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx
* packages/thirdweb/src/bridge/types/Route.ts
* packages/thirdweb/src/bridge/index.ts
* packages/thirdweb/src/bridge/OnrampStatus.ts
* packages/thirdweb/src/bridge/Status.ts
* packages/thirdweb/src/bridge/Onramp.ts
* packages/thirdweb/src/bridge/Transfer.ts
* packages/thirdweb/src/bridge/Sell.ts
* packages/thirdweb/src/bridge/Chains.ts
* packages/thirdweb/src/react/web/utils/errors.ts
* packages/thirdweb/src/bridge/Routes.ts
* packages/thirdweb/src/bridge/types/Errors.ts
* packages/thirdweb/src/bridge/Buy.ts

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (8)</summary>

* GitHub Check: Unit Tests
* GitHub Check: Build Packages
* GitHub Check: Size
* GitHub Check: E2E Tests (pnpm, esbuild)
* GitHub Check: Lint Packages
* GitHub Check: E2E Tests (pnpm, webpack)
* GitHub Check: E2E Tests (pnpm, vite)
* GitHub Check: Analyze (javascript)

</details>

<details>
<summary>🔇 Additional comments (4)</summary><blockquote>

<details>
<summary>packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx (2)</summary>

`288-295`: **Improved error display structure**

The error display has been simplified to consistently show error title and message in a cleaner layout. This aligns with the broader effort to standardize error handling using the new `ApiError` class.

---

`312-320`: **Simplified action button logic**

The conditional button rendering has been streamlined to show a "Pay with another token" button for any error or insufficient balance case, removing the special handling for minimum amount errors. This makes the code more maintainable.

</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx (2)</summary>

`228-234`: **Standardized error display format**

The error display implementation has been simplified to consistently show the error title and message, removing special case handling for minimum amount errors. This creates a more consistent user experience across different error types.

---

`238-264`: **Consolidated button implementation**

The button implementation has been simplified to always show a "Continue" button with appropriate disabled states. This makes the code more maintainable and creates a more consistent user experience.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAbQBlABEAaQBdSABJZl58KUhKCnw+WExaL3gMIhQsKzRZAFFmATpoyDlIbERKSCF8NCD4ZjApClJkADN8Bk7pfiwyEowGCqqCoshFspXIAHd1BCxcWA8AAyP4ClodkgETyCTkjRhjyABrEnkGRdIUZCOPCq4Qq0bBieD4LD4cboSDkHb5CiFPgMLxoRCIAA0kBOAEFuPB6oiiicsWhaEp6BVsdw0AxXmgxgB6c6Xa4CRmICgMRkCCjwWikZmybjSRmEpGIDS4RAnJ5wVAotHIfzcVEMWb/DpdfjQ0jkPkMBFIsKwQo7ZC0wroyDMbziVUecbwSKYniFCT87bMIoAjCTCjMaiSDylexA0G4bD+ehrPhsdEM6QaNwvWzoLyIfB+Eiq2kal4nABCfIFJBxYIhd1wwo8eyO2PL4kr1UgEmc4M6kCdLrCWcGOTy1ZFCgwiCQNCWsie4vWm3KlRbXRGaF83pBPdQ2G4tGoUQIHXE5QAXh5NXCG/iZxQ7orrRVEDQyTrIHrKPBDbHXTsEF8UNl3bMip8tW6AYPQSgCNgRBENsDBoDSajlOISaQDi5LqOCGArl4shYrGNrSIgiYTOsFRtuU9D+EEIQWv4+QYIs6qUocLw0A+XbOqcNj4HgSZsZo0qykYADyy4+Fi/zal8mBjOggy9jaaDvEa6wqkU4gLnWBwmh4Dw2j6I5jg+7CgfQxxeNw4zeG08gDp6C6ICKyxOh+RJ8BU/qBk2WChv27petoGC4IFKjOuo8hQjpKnFKU85VEwSjJgYFiQAAwiwbBBcgDhOC4KYeEwrDsMgEImqg3DeL4VHBOxzg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oNUCAE1pqhVSKpID9rg1tAQ1QIFnWartVratAOKvGCqq5VJ6pdUKpJVkJ1AHK4rtyqiy8raAumfpE2qAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=thirdweb-dev/js&utm_content=7119):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@joaquim-verges joaquim-verges changed the title [Bridge] Improve error handling in PayEmbed [SDK] Improve error handling in PayEmbed May 22, 2025
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels May 22, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented May 22, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 56.64 KB (+0.13% 🔺) 1.2 s (+0.13% 🔺) 238 ms (+239.71% 🔺) 1.4 s
thirdweb (cjs) 309.36 KB (-0.06% 🔽) 6.2 s (-0.06% 🔽) 613 ms (+5.8% 🔺) 6.8 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 109 ms (+2545.28% 🔺) 223 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 42 ms (+2176.48% 🔺) 52 ms
thirdweb/react (minimal + tree-shaking) 19.5 KB (0%) 390 ms (0%) 118 ms (+929.14% 🔺) 508 ms

Copy link

codecov bot commented May 22, 2025

Codecov Report

Attention: Patch coverage is 32.11679% with 93 lines in your changes missing coverage. Please review.

Project coverage is 55.62%. Comparing base (88533d9) to head (f83cbd2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nnectWallet/screens/Buy/fiat/FiatScreenContent.tsx 0.00% 29 Missing ⚠️
packages/thirdweb/src/react/web/utils/errors.ts 10.00% 18 Missing ⚠️
...nnectWallet/screens/Buy/swap/SwapScreenContent.tsx 0.00% 7 Missing ⚠️
packages/thirdweb/src/bridge/Buy.ts 53.84% 6 Missing ⚠️
packages/thirdweb/src/bridge/Chains.ts 14.28% 6 Missing ⚠️
packages/thirdweb/src/bridge/OnrampStatus.ts 14.28% 6 Missing ⚠️
packages/thirdweb/src/bridge/Sell.ts 53.84% 6 Missing ⚠️
packages/thirdweb/src/bridge/Status.ts 14.28% 6 Missing ⚠️
packages/thirdweb/src/bridge/Onramp.ts 57.14% 3 Missing ⚠️
packages/thirdweb/src/bridge/Transfer.ts 57.14% 3 Missing ⚠️
... and 2 more

❌ Your patch status has failed because the patch coverage (32.11%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7119      +/-   ##
==========================================
+ Coverage   55.59%   55.62%   +0.02%     
==========================================
  Files         901      902       +1     
  Lines       58121    58135      +14     
  Branches     4068     4087      +19     
==========================================
+ Hits        32315    32337      +22     
+ Misses      25701    25693       -8     
  Partials      105      105              
Flag Coverage Δ
packages 55.62% <32.11%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
packages/thirdweb/src/bridge/index.ts 100.00% <ø> (ø)
packages/thirdweb/src/bridge/types/Errors.ts 100.00% <100.00%> (ø)
...ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx 14.47% <0.00%> (ø)
packages/thirdweb/src/bridge/Routes.ts 85.18% <71.42%> (-2.32%) ⬇️
packages/thirdweb/src/bridge/Onramp.ts 64.21% <57.14%> (-0.63%) ⬇️
packages/thirdweb/src/bridge/Transfer.ts 92.95% <57.14%> (-4.06%) ⬇️
packages/thirdweb/src/bridge/Buy.ts 92.06% <53.84%> (-4.58%) ⬇️
packages/thirdweb/src/bridge/Chains.ts 55.00% <14.28%> (-16.43%) ⬇️
packages/thirdweb/src/bridge/OnrampStatus.ts 14.28% <14.28%> (+2.52%) ⬆️
packages/thirdweb/src/bridge/Sell.ts 92.85% <53.84%> (-4.63%) ⬇️
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant