fix: resolve 5 sentry alerts in sample apps#363
Conversation
- Fix StateError on closed WebSocket sink by storing and canceling subscriptions - Add null-safe access in activity_page error handlers to prevent TypeError - Handle ReownSignError in modal request flow instead of rethrowing - Wrap WebSocket handshake and stream errors in try-catch blocks - Increase app initialization timeout and add yield points to prevent hanging All changes include test coverage validation (140/140 core tests pass).
|
Claude finished @ignaciosantise's task in 2m 23s —— View job PR Review
Found 4 issue(s)Issue 1: ReownSignError still rethrown after UI broadcast — Sentry alert may persistID: appkit-modal-reownsignerror-rethrow-a7f2 Context:
Recommendation: Suppress the rethrow for } else if (e is ReownSignError) {
onModalError.broadcast(ModalError(e.message));
return; // don't rethrow — already handled via UI broadcast
}
rethrow;Issue 2: Pervasive silent
|
There was a problem hiding this comment.
Pull request overview
Addresses multiple Sentry alerts in the walletkit/appkit sample apps and underlying relay/websocket plumbing by hardening error handling and reducing UI-thread blocking during initialization.
Changes:
- Add stream subscription tracking + safer close/write handling in
WebSocketHandlerto avoid “write to closed sink” races and wrap connect readiness failures. - Make activity page analytics/error handling null-safe to avoid crashy
!usage in error paths. - Adjust modal request error handling (Coinbase + ReownSignError) and sample walletkit initialization timing/yield points to reduce UI hangs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/reown_walletkit/example/lib/main.dart | Extends GetIt allReady timeout and yields between init steps to reduce UI stalls in the example app. |
| packages/reown_core/lib/relay_client/websocket/websocket_handler.dart | Tracks input/output subscriptions, wraps sink operations, and improves readiness error handling for websocket connect/disconnect races. |
| packages/reown_appkit/lib/modal/pages/activity_page.dart | Removes unsafe null assertions in error/analytics paths by gating analytics on session/appKit presence. |
| packages/reown_appkit/lib/modal/appkit_modal_impl.dart | Adds ReownSignError handling/broadcasting during request flow and refactors Coinbase exception branch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| } else if (e is CoinbaseServiceException) { | ||
| // If the error is due to no session on Coinbase Wallet we disconnnect the session on Modal. | ||
| // This is the only way to detect a missing session since Coinbase Wallet is not sending any event. | ||
| throw ReownAppKitModalException('Coinbase Wallet Error'); | ||
| } else if (e is ReownSignError) { | ||
| onModalError.broadcast(ModalError(e.message)); | ||
| } | ||
| rethrow; |
- Stop rethrowing ReownSignError after UI broadcast (comment #1) - Add debugPrint logging in all silent catch blocks (comment #2) - Clean up socket/controllers on failed handshake via close() (comment #3) - Move chainId validation inside try/catch so it's handled (comment #4) - Fix "disconnnect" typo in comment (comment #6) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Fixes 5 distinct Sentry alerts affecting the wallet and dapp sample apps:
Changes
Testing
Due Diligence