fix(marketplace): surface wallet errors when buying a resale ticket - #196
Merged
presidojay1 merged 2 commits intoSep 26, 2026
Conversation
Returns the message of an ApiError or WalletError (rejected Freighter popup, locked extension, wrong network) and a fallback otherwise.
handleBuy only showed err.message for ApiError, so a rejected Freighter popup, locked extension or wrong network fell through to the generic 'Could not complete the purchase.' Use actionErrorMessage so WalletError messages reach the user too.
|
@posimideveloper 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! 🚀 |
❌ Deploy Preview for stellartickets failed.
|
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.
Problem
In
src/app/marketplace/page.tsx, thehandleBuycatch block only showederr.messagefor anApiError. AWalletErrorthrown bysignAndSubmitfell through to the generic "Could not complete the purchase." That covers a rejected Freighter popup, a locked extension, and the wrong network. The user got no hint about what to fix.Fix
src/lib/action-error.ts→actionErrorMessage(err, fallback). It returns the message of anApiErroror aWalletError. It returnsfallbackfor unknown errors, non-Errorvalues, or a known error with an empty message.marketplace/page.tsx:handleBuynow callssetError(actionErrorMessage(err, 'Could not complete the purchase.')). Wallet problems like "User declined access" or "Transaction signing was rejected" are now shown to the user. The unusedApiErrorimport is dropped.The helper can be reused by other pages with the same
ApiError-only pattern, such as My tickets and the dashboard. This PR keeps its scope to the marketplace as the issue asks.Commits
feat(lib): add actionErrorMessage helper for wallet-backed actions: the helper plusaction-error.test.ts. The tests coverApiError,WalletError, unknown errors, and an empty message.fix(marketplace): surface wallet errors when buying a resale ticketTesting
There are new unit tests for the helper. They weren't run locally because there's no
node_modulesin my checkout, sovitestwill run them in CI.Closes #58
Closes #59
Closes #60
Closes #61