Skip to content

feat(api): map all known Stellar result codes to friendly error messages - #2

Open
vickydve wants to merge 7 commits into
mainfrom
feature/135-stellar-error-codes
Open

feat(api): map all known Stellar result codes to friendly error messages#2
vickydve wants to merge 7 commits into
mainfrom
feature/135-stellar-error-codes

Conversation

@vickydve

Copy link
Copy Markdown
Owner

What does this PR do?

Expands backend/src/api/utils/horizonError.ts to map the full set of documented Stellar transaction- and operation-level result codes (tx_bad_seq, tx_too_late, op_underfunded, op_low_reserve, op_no_issuer, etc.) to clear, actionable error messages, instead of falling through to the generic 502 network-error response.

Addresses BigNathan1/CoopLumen#166 (backlog reference BigNathan1#135).

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Tests only

Testing

  • Added backend/src/api/utils/__tests__/horizonError.test.ts with full coverage of every mapped transaction and operation result code, plus fallback paths (unmapped code, 404, detail/title fallback, generic error).
  • npx jest src/api/utils/__tests__/horizonError.test.ts — 63 passing.
  • npx eslint on changed files — clean.
  • npx tsc --noEmit — no new errors (one pre-existing, unrelated error on main in contracts/transactions is untouched by this change).

Checklist

  • Tests added/updated
  • Docs updated (CHANGELOG.md)
  • No secrets in diff
  • Rebased on upstream/main

Generated by Claude Code

claude and others added 7 commits August 27, 2026 22:10
Extend the Horizon error mapper with the full set of documented
transaction and operation result codes (tx_too_late, tx_bad_auth,
op_low_reserve, op_no_issuer, and others) so callers get an
actionable message instead of falling through to the generic
502 network-error response.

Closes BigNathan1#166
Formalizes BigNathan1 as sole maintainer with write access to main, and replaces the old maintainer-nomination path with the CONTRIBUTORS.md leaderboard for recognition.
Closes BigNathan1#153. Adds full Stellar account details endpoint (sequence, thresholds, flags, balances, signers, data) with Zod validation, exponential backoff retries on Horizon 429/503, mapped error responses, unit + testnet integration tests, and OpenAPI/CHANGELOG updates.
Closes BigNathan1#155. Adds POST /api/v1/trustlines/build for unsigned changeTrust XDR (Freighter/Albedo client-side signing), with optional custom limits, Zod validation, mapped Horizon errors, tests, and OpenAPI/CHANGELOG updates. Rebased onto main by the maintainer to resolve a trivial add/add conflict on transactions.ts against BigNathan1#586 — re-verified with tsc --noEmit and the full trustlines/accounts test suite before merge.
…elpers

Closes BigNathan1#172. Adds isTestnet()/isMainnet() boolean helpers to StellarService, with unit tests and CHANGELOG update. Rebased onto main by the maintainer to resolve a CHANGELOG.md conflict; re-verified with tsc --noEmit and the stellar.test.ts suite before merge.
Closes BigNathan1#137. Adds GET /api/v1/prices/xlm with CoinGecko/Binance/Coinbase failover, 3.5s per-provider timeout, 30s Redis caching, Zod validation, and unit/integration tests plus OpenAPI/CHANGELOG updates. Rebased onto main by the maintainer to resolve conflicts against BigNathan1#586/BigNathan1#587/BigNathan1#588 (all merged just ahead of this one) in CHANGELOG.md, routes/index.ts, and openapi.yaml; re-verified with tsc --noEmit and the full price/account/trustline test suites before merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants