-
Notifications
You must be signed in to change notification settings - Fork 36
fix: renew uri after failure #501
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
Conversation
🦋 Changeset detectedLatest commit: d8c49ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
|
Claude finished @ignaciosantise's task —— View job Code Review Complete ✓Todo List:
Review Findings1. Missing Changeset
|
There was a problem hiding this 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 enhances error handling for wallet connection flows by introducing more granular error identification and tracking. The changes improve user experience by distinguishing between user-initiated rejections, proposal expiry, and general connection errors, providing more appropriate feedback and analytics tracking for each case.
Key Changes
- Added utility methods in
ErrorUtilto identify RPC provider errors, user rejection errors, and proposal expiry errors - Introduced a new
USER_REJECTEDevent type for tracking user-initiated rejections separately from general connection errors - Updated
ConnectingViewto use the new error utilities and provide context-specific error messages to users
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/common/src/utils/ErrorUtil.ts | Added RPC error code constants and four new error detection methods to identify and categorize different types of connection errors |
| packages/common/src/types/api/events.ts | Added USER_REJECTED event type and corresponding event structure for tracking user rejection events |
| packages/appkit/src/views/w3m-connecting-view/index.tsx | Updated error handling to use new error utilities, show context-appropriate error messages, and track user rejections separately |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude review |
|
Claude finished @ignaciosantise's task —— View job 🔄 Incremental Review: Code Review CompleteTodo List:
Validation of Previous Review Comments✅ Resolved Issues
New Issues Found1. Type Safety: Inconsistent Error Type NarrowingFile: const isUserRejectedMethodsCode =
error?.code === ErrorUtil.RPC_ERROR_CODE.USER_REJECTED_METHODS;After Recommendation: const isUserRejectedMethodsCode =
error.code === ErrorUtil.RPC_ERROR_CODE.USER_REJECTED_METHODS;2. Unused Constant: USER_REJECTED (5000)File: The constant Options:
3. Overly Broad String MatchingFile: The proposal expiry check uses a broad substring match: error.message?.toLowerCase().includes('proposal expired')While better than just
For WalletConnect, proposal expiry errors likely have a specific format. Consider using a more precise check or regex pattern if the exact error message format is known. 4. Missing JSDoc DocumentationFile: The new utility methods lack JSDoc documentation. According to React Native best practices, public APIs should be documented with JSDoc comments explaining:
Example: /**
* Checks if an error is an RPC provider error with required code and message properties
* @param error - The error object to check
* @returns True if the error has both `code` (number) and `message` (string) properties
*/
isRpcProviderError(error: any): error is { message: string; code: number } {
// ...
}5. Event Type Missing Context PropertiesFile: The new | {
type: 'track';
address?: string;
event: 'USER_REJECTED';
properties: {
message: string;
};
}Recommendation: Add optional context properties for richer analytics: properties: {
message: string;
errorCode?: number; // RPC error code if available
walletId?: string; // Wallet identifier
reconnect?: boolean; // Was this a reconnection attempt?
}This would help track patterns like:
6. Potential Race Condition in Retry LogicFile: The retry logic in the catch block has a potential issue: catch (error) {
LogController.sendError(error, 'ConnectingView.tsx', 'initializeConnection');
WcController.setWcError(true);
WcController.clearUri();
if (isQr && CoreHelperUtil.isAllowedRetry(lastRetry)) {
setLastRetry(Date.now());
initializeConnection(true); // Recursive call
}
const isUserRejected = ErrorUtil.isUserRejectedRequestError(error);
// ... error handling continuesIssues:
Recommendation: if (isQr && CoreHelperUtil.isAllowedRetry(lastRetry)) {
setLastRetry(Date.now());
initializeConnection(true);
return; // Don't show errors if we're retrying
}This ensures errors are only shown when no retry is attempted. SummaryStill Present from Previous Reviews:
New Issues:
Positive Observations:
Recommended ActionsHigh Priority:
Medium Priority: Low Priority: Note: I cannot run linters, type checkers, or tests in this environment. Please ensure you run:
to validate the changes before merging. |
|



This pull request introduces improved error handling and event tracking for user-initiated rejection and proposal expiry during wallet connection flows. The changes add new utility methods for error identification, update event types to distinguish between general connection errors and user rejections, and enhance user feedback in the UI.
Error handling improvements:
ErrorUtil(isRpcProviderError,isUserRejectedMessage,isUserRejectedRequestError,isProposalExpiredError) to more accurately identify user rejection and proposal expiry errors. Also defined new RPC error codes for user rejection scenarios. [1] [2]UI and feedback enhancements:
ConnectingViewcomponent to use the new error utility methods for distinguishing between user rejection and other errors. Now shows a specific error message ("User rejected the request") when appropriate, and only displays generic errors for other cases. [1] [2]Event tracking updates:
'USER_REJECTED'to theEventNameunion and corresponding event object to theEventtype, allowing the system to track user-initiated rejection separately from general connection errors. [1] [2]Note
Renews WalletConnect URI on failures, adds user-rejection error utilities and event, updates connecting views to use them, and tweaks text truncation in UI.
connectpromise and auto-retry for QR with timestamp guard.ErrorUtilto distinguish user rejection vs other/proposal-expired errors; show specific snackbars and map toUSER_REJECTEDvsCONNECT_ERRORevents.ErrorUtilRPC codes and helpers:isRpcProviderError,isUserRejectedMessage,isUserRejectedRequestError,isProposalExpiredError,isWalletNotFoundError,categorizeConnectionError.EventNameandEventwithUSER_REJECTEDtracking.ConnectingBodytitle centered and single-line; addflexShrinkto header/store texts to prevent truncation issues.Written by Cursor Bugbot for commit d8c49ea. This will update automatically on new commits. Configure here.