feat(client): decode contract error codes into typed SDK errors - #366
Open
DammyAji wants to merge 2 commits into
Open
feat(client): decode contract error codes into typed SDK errors#366DammyAji wants to merge 2 commits into
DammyAji wants to merge 2 commits into
Conversation
Parse Error(Contract, #N) from Stellar RPC simulation and submission failures and map them to typed error subclasses, so callers can use instanceof checks instead of parsing XDR dumps. - Add typed error subclasses for codes 1-8 (CircleNotFoundError, RoundNotFundedError, WrongRoundTagError, AlreadyClaimedError, InvalidProofError, RoundFullError, OverflowError, CircleCancelledError) - Create decodeError.ts with regex-based parser that walks the error cause chain to find Error(Contract, #N) patterns - Add withRetry helper for transient RPC errors (was referenced but missing) - Wrap every call site in contract.ts so thrown errors are normalised - Update toUiError in App.tsx to use instanceof-based lookup (no XDR string matching) - Add docs/errors.md with shared error code table - Add 17 vitest tests using recorded real RPC error payloads Closes crackedstudio#281 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Author
|
hi @Otaiki1 please kindly review and merge. Thank you. |
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.
Summary
Parses Error(Contract, #N) from Stellar RPC simulation and submission failures and maps them to typed error subclasses, so callers can use instanceof checks instead of parsing XDR dumps.
What changed
Acceptance criteria
Closes #281