fix(wallet): translate Cashu NUT error codes into plain-language messages #132

Open
ssmithx wants to merge 0 commits from cashu-error-messages into main
Collaborator

Mint HTTP failures (swap/melt/mint-quote) were surfacing raw JSON bodies
like {"detail":"proofs already spent","code":11001} straight to the
user. Add a translator for the NUT-02/03/04/05 transaction-validation
error codes (10001-11017, 12001-12003; see
https://github.com/cashubtc/nuts/blob/main/error_codes.md) and layer it
onto the mint_client bail sites via anyhow context, so the top-level
message is actionable while the raw status/body stays available via
{:#} for logs. receive_token now surfaces the real reason (e.g. "This
ecash has already been redeemed") instead of a generic "Failed to
receive any proofs from token" when every mint in a token fails.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Summary

Verification

Checklist

  • Rust formatting/clippy/tests pass when backend code changed.
  • Frontend type-check/build/tests pass when frontend code changed.
  • App manifests validate when app packaging changed.
  • Generated catalogs are updated when manifest-owned catalog fields changed.
  • Docs are updated for user-facing or developer-facing behavior changes.
  • No secrets, generated build outputs, local screenshots, or private host details are included.
Mint HTTP failures (swap/melt/mint-quote) were surfacing raw JSON bodies like {"detail":"proofs already spent","code":11001} straight to the user. Add a translator for the NUT-02/03/04/05 transaction-validation error codes (10001-11017, 12001-12003; see https://github.com/cashubtc/nuts/blob/main/error_codes.md) and layer it onto the mint_client bail sites via anyhow context, so the top-level message is actionable while the raw status/body stays available via {:#} for logs. receive_token now surfaces the real reason (e.g. "This ecash has already been redeemed") instead of a generic "Failed to receive any proofs from token" when every mint in a token fails. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> ## Summary <!-- What changed and why? --> ## Verification <!-- Commands run, devices tested, screenshots, or reason testing was not run. --> ## Checklist - [ ] Rust formatting/clippy/tests pass when backend code changed. - [ ] Frontend type-check/build/tests pass when frontend code changed. - [ ] App manifests validate when app packaging changed. - [ ] Generated catalogs are updated when manifest-owned catalog fields changed. - [ ] Docs are updated for user-facing or developer-facing behavior changes. - [ ] No secrets, generated build outputs, local screenshots, or private host details are included.
ssmithx added 1 commit 2026-08-05 09:43:52 +00:00
Mint HTTP failures (swap/melt/mint-quote) were surfacing raw JSON bodies
like {"detail":"proofs already spent","code":11001} straight to the
user. Add a translator for the NUT-02/03/04/05 transaction-validation
error codes (10001-11017, 12001-12003; see
https://github.com/cashubtc/nuts/blob/main/error_codes.md) and layer it
onto the mint_client bail sites via anyhow context, so the top-level
message is actionable while the raw status/body stays available via
{:#} for logs. receive_token now surfaces the real reason (e.g. "This
ecash has already been redeemed") instead of a generic "Failed to
receive any proofs from token" when every mint in a token fails.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This branch is already included in the target branch. There is nothing to merge.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin cashu-error-messages:cashu-error-messages
git checkout cashu-error-messages
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lfg2025/archy#132