feat: map Soroban simulation failures to human-readable BetModal errors (#406) - #499
Open
meem08 wants to merge 1 commit into
Open
feat: map Soroban simulation failures to human-readable BetModal errors (#406)#499meem08 wants to merge 1 commit into
meem08 wants to merge 1 commit into
Conversation
…l errors Translate common Soroban simulation and Freighter signing errors into human-readable copy in the BetModal (fee estimate + submit flows) so players see actionable messages instead of raw SDK internals. The raw error is kept in the console for debugging, and unknown errors fall back to a safe generic message. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@meem08 is attempting to deploy a commit to the josephchimebuka's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #406
Summary
Translates common Soroban simulation and Freighter signing errors into player-friendly copy shown in the BetModal — both the fee-estimate failure panel and the transaction failure timeline — so players see actionable messages instead of raw SDK / HostError internals. The raw error is always kept in the console for debugging.
Changes
src/lib/xelma-contract.ts— new exportedhumanizeContractError(error, context?):CONTRACT_ERROR_FALLBACK).[xelma-contract:<context>]prefix for debugging.src/components/BetModal.tsx— useshumanizeContractErrorfor both the fee-estimate failure message and the transaction failure timeline (tx.fail(...)).humanizeContractErrorunit-test suite insrc/lib/__tests__/xelma-contract.test.ts(mapped cases, fallback for unknown/null errors, raw-error console logging) and updated the two BetModal test files' mocks/assertions to expect the friendly copy.Acceptance criteria
Verification
pnpm exec tsc -b— passespnpm build— passespnpm test:unit— 791 tests passreact-hooks/set-state-in-effecterrors in PredictionHistory.tsx / PriceChart.tsx / Dashboard.tsx / Learn.tsx are unrelated to this change)