Skip to content
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

feat: support a specific error code for user rejection during wallet connection #120

Merged
merged 2 commits into from
Feb 25, 2023

Conversation

bruceeewong
Copy link
Contributor

As we enhanced our error handling for wallet connection, we can now detect precisely for the error reason during wallet connection.
Now developers can easily process thier custom logic when user rejects the connection request as follows:

import {ConnectButton, ErrorCode, BaseError} from "@suiet/wallet-kit";

<ConnectButton
    onConnectError={(err: BaseError) => {
      if (err.code === ErrorCode.WALLET__CONNECT_ERROR__USER_REJECTED) {
        console.warn('user rejected the connection to ' + err.details?.wallet)
      } else {
        console.warn('unknown connect error: ', err)
      }
    }}
 />

The BaseError instance has properties like code, message and details for developers to further customize their error handling.

@vercel
Copy link

vercel bot commented Feb 25, 2023

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

Name Status Preview Comments Updated
wallet-kit ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 25, 2023 at 2:30AM (UTC)
wallet-kit-demo ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 25, 2023 at 2:30AM (UTC)
wallet-kit-demo-test ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 25, 2023 at 2:30AM (UTC)

@bruceeewong bruceeewong added this pull request to the merge queue Feb 25, 2023
Merged via the queue into main with commit d9d53a0 Feb 25, 2023
@bruceeewong bruceeewong deleted the feat/connect-error-type branch February 25, 2023 04:18
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.

2 participants