fix(wallet): structured error handling with WalletError class and err…#326
Merged
Smartdevs17 merged 1 commit intoApr 28, 2026
Conversation
…or rate tracking - Add WalletError class with code, userMessage, and recovery fields - Add WalletErrorCode enum covering all failure scenarios - Add ErrorRateTracker to record error frequency by code - Replace raw throw/console.error patterns with toWalletError helper - Wrap getTokenBalances, estimateGas, createSuperfluidStream, createSablierStream, approveErc20, estimateApproveGas, getWalletSigner - User-facing messages are short and safe (no sensitive info exposed) - Recovery hints provided where actionable - Update tests to assert on WalletError shape, code, and recovery - Add coverage for errorTracker and WalletError cause stack Closes Smartdevs17#41
|
@Sendi0011 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(wallet): structured error handling in walletService (#41)
Problem
Errors across
walletService.tswere either swallowed withconsole.errorand re-thrown raw, or thrown as plainErrorobjects with no context — leaving users with generic messages and no path to recovery.What changed
WalletErrorclass withcode,userMessage, andrecoveryfields — callers can now branch onerror.codeand surfaceerror.recoverydirectly in the UIWalletErrorCodeenum covering all failure scenarios (NOT_CONNECTED,USER_REJECTED,NETWORK_MISMATCH,BALANCE_FETCH_FAILED,GAS_ESTIMATION_FAILED,STREAM_CREATION_FAILED,APPROVAL_FAILED)ErrorRateTracker(exported aserrorTracker) to record error frequency by code — plug into your monitoring layer viaerrorTracker.getStats()throw error/console.error + rethrowpatterns with atoWalletErrorhelper that logs full detail for debugging while returning a safe, short user messagegetWalletSigner,getTokenBalances,estimateGas,createSuperfluidStream,createSablierStream,approveErc20,estimateApproveGasTests
Updated existing tests to assert on
WalletErrorshape and added new coverage forerrorTracker,WalletErrorcause-stack preservation, andBALANCE_FETCH_FAILEDstructured error.Closes #41