Skip to content

refactor: update error boundary to handle wk error messages properly#4966

Merged
enesozturk merged 4 commits intomainfrom
enes/apkt-3599-error-messages-should-be-improved-for-all-chains-and
Sep 7, 2025
Merged

refactor: update error boundary to handle wk error messages properly#4966
enesozturk merged 4 commits intomainfrom
enes/apkt-3599-error-messages-should-be-improved-for-all-chains-and

Conversation

@enesozturk
Copy link
Copy Markdown
Contributor

@enesozturk enesozturk commented Sep 5, 2025

Description

When any error thrown on WalletKit, AppKit handle those with withErrorBoundary and stringifying objects. But the WK errors already returned as object and includes message property which will be enough for us to show proper messages.

In this PR it updates the error boundary to look for the error.message first use it if exist.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-3595
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

@linear
Copy link
Copy Markdown

linear bot commented Sep 5, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 5, 2025

🦋 Changeset detected

Latest commit: 89e4fde

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

This PR includes changesets to release 24 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-ui Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-cdn Patch
@reown/appkit-universal-connector Patch
@reown/appkit-testing Patch
@reown/appkit-common Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-cli Patch
@reown/appkit-codemod 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

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Sep 5, 2025 0:49am
appkit-demo Ready Ready Preview Comment Sep 5, 2025 0:49am
appkit-gallery Ready Ready Preview Comment Sep 5, 2025 0:49am
appkit-laboratory Ready Ready Preview Comment Sep 5, 2025 0:49am
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Sep 5, 2025 0:49am
appkit-basic-sign-client-example Ignored Ignored Sep 5, 2025 0:49am
appkit-basic-up-example Ignored Ignored Sep 5, 2025 0:49am
appkit-ethers5-bera Ignored Ignored Sep 5, 2025 0:49am
appkit-nansen-demo Ignored Ignored Sep 5, 2025 0:49am
appkit-vue-solana Ignored Ignored Sep 5, 2025 0:49am
appkit-wagmi-cdn-example Ignored Ignored Sep 5, 2025 0:49am
ethereum-provider-wagmi-example Ignored Ignored Sep 5, 2025 0:49am
next-wagmi-solana-bitcoin-example Ignored Ignored Sep 5, 2025 0:49am
vue-wagmi-example Ignored Ignored Sep 5, 2025 0:49am

@enesozturk enesozturk marked this pull request as ready for review September 5, 2025 12:23
Copilot AI review requested due to automatic review settings September 5, 2025 12:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the error boundary to better handle WalletKit error messages by extracting the message property from error objects before falling back to JSON stringification.

  • Updates error handling logic to prioritize error.message over JSON stringification
  • Adds a changeset documenting the improvement to error message display in toasts

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/controllers/src/utils/withErrorBoundary.ts Modified error handler to extract message property from error objects
.changeset/ready-ducks-send.md Added changeset documenting the error handling improvement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 5, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.33% 34897 / 44547
🔵 Statements 78.33% 34897 / 44547
🔵 Functions 76.1% 3842 / 5048
🔵 Branches 86.61% 8238 / 9511
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/controllers/src/utils/withErrorBoundary.ts 91.11% 93.93% 100% 91.11% 41, 49-56, 76-80
Generated in workflow #14875 for commit 89e4fde by the Vitest Coverage Report Action

@enesozturk enesozturk deleted the enes/apkt-3599-error-messages-should-be-improved-for-all-chains-and branch September 7, 2025 18:57
@github-actions github-actions bot mentioned this pull request Sep 9, 2025
@linear
Copy link
Copy Markdown

linear bot commented Sep 11, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants