feat(errors): implement human-readable Stellar and Soroban error decoder (#180) - #205
Merged
JamesEjembi merged 2 commits intoAug 22, 2026
Merged
Conversation
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 of Changes
This pull request resolves #180 by implementing a human-readable dictionary and decoding pipeline mapping cryptic Stellar Horizon transaction errors (
tx_failed,op_underfunded,tx_bad_seq,op_no_trust) and Soroban RPCHostError/ContractErrorcodes into actionable diagnostics with recommended troubleshooting steps.🎯 Key Implementations
src/utils/errorDecoder.ts— Error Catalog & High-Performance DecoderERROR_CATALOG: Strongly-typed dictionary mapping 60+ low-level transaction codes, operation codes, Soroban host errors, contract revert codes, and wallet/network errors into human descriptions and troubleshooting steps.extractErrorMessage: Normalizes arbitrary error inputs (strings, Error instances, Axios/Fetch errors, JSON-RPC responses, Horizonresult_codes).decodeTransactionError: High-performance regex and code matching executing in under 0.01ms per lookup (< 0.1ms target).ContractError(#)).null,undefined, empty string, numbers, unknown errors).src/components/shared/ErrorDisplay.tsx— Accessible Error Display ComponentCritical Error,Warning,Notice) with distinct theme styling.docsUrl) when available.onDismissandonRetrycallbacks.API Integration (
src/lib/api/staking.ts)decodeTransactionError.Comprehensive Unit & Component Tests (
src/__tests__/errorDecoder.test.ts,src/__tests__/ErrorDisplay.test.tsx)🧪 Verification & Testing
npm run test:unit: