Skip to content

fix(marketplace): surface wallet errors when buying a resale ticket - #196

Merged
presidojay1 merged 2 commits into
StellarTickets:mainfrom
posimideveloper:fix/58-surface-wallet-errors-marketplace
Sep 26, 2026
Merged

presidojay1 merged 2 commits into
StellarTickets:mainfrom
posimideveloper:fix/58-surface-wallet-errors-marketplace

Conversation

@posimideveloper

@posimideveloper posimideveloper commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In src/app/marketplace/page.tsx, the handleBuy catch block only showed err.message for an ApiError. A WalletError thrown by signAndSubmit fell 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

  • New src/lib/action-error.ts → actionErrorMessage(err, fallback). It returns the message of an ApiError or a WalletError. It returns fallback for unknown errors, non-Error values, or a known error with an empty message.
  • marketplace/page.tsx: handleBuy now calls setError(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 unused ApiError import 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

  1. feat(lib): add actionErrorMessage helper for wallet-backed actions: the helper plus action-error.test.ts. The tests cover ApiError, WalletError, unknown errors, and an empty message.
  2. fix(marketplace): surface wallet errors when buying a resale ticket

Testing

There are new unit tests for the helper. They weren't run locally because there's no node_modules in my checkout, so vitest will run them in CI.
Closes #58
Closes #59
Closes #60
Closes #61

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.
@drips-wave

drips-wave Bot commented Sep 26, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@netlify

netlify Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for stellartickets failed.

Name Link
🔨 Latest commit dec4408
🔍 Latest deploy log https://app.netlify.com/projects/stellartickets/deploys/6ab7f5498b13c40008c82a0e

@presidojay1
presidojay1 merged commit ed6e054 into StellarTickets:main Sep 26, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants