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

Improve Error Message for Failed Wallet Connections in Mobile Browsers #5388

Open
0xShankar opened this issue Sep 25, 2024 · 1 comment
Open

Comments

@0xShankar
Copy link

Description:
When using WalletConnect on mobile browsers, users often encounter generic error messages like "Connection failed" when a wallet connection does not go through. This error message lacks context and doesn’t explain why the connection failed, leaving users confused. It would be more helpful to display a specific error message based on the root cause (e.g., network not supported, wallet timeout, or user rejection).

Steps to Reproduce:
Open a DApp that uses WalletConnect on a mobile browser.
Attempt to connect a wallet.
If the connection fails (due to network issues or user rejection), observe the error message displayed.

Expected Behavior:
Instead of a generic "Connection failed" message, display a more specific error message based on the reason for failure. For example:

"Network not supported. Please switch to Ethereum Mainnet."
"Wallet connection timeout. Please try again."
"User rejected the connection request."

Proposed Solution:
Error Categorization: Modify the handleError function in the walletconnect-monorepo repository to categorize errors and map them to specific, user-friendly messages.

Error Message Mapping:

Add a new utility function that checks the error type (e.g., network issue, user rejection, wallet timeout) and returns a specific message.

Example:

function getErrorMessage(error) {
  if (error.type === 'network') {
    return "Network not supported. Please switch to Ethereum Mainnet.";
  } else if (error.type === 'timeout') {
    return "Wallet connection timeout. Please try again.";
  } else if (error.type === 'user_rejected') {
    return "User rejected the connection request.";
  } else {
    return "Connection failed. Please try again.";
  }
}

UI Enhancement:

Ensure that this specific error message is displayed in the modal or toast that appears when the connection fails

Copy link

linear bot commented Sep 25, 2024

CR-536 Improve Error Message for Failed Wallet Connections in Mobile Browsers

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

No branches or pull requests

1 participant