Skip to content

fix(coinpay): surface detailed error responses and propagate status fetch failures (fixes #93) - #107

Closed
Echolonius wants to merge 1 commit into
profullstack:masterfrom
Echolonius:fix/coinpay-error-handling
Closed

Echolonius wants to merge 1 commit into
profullstack:masterfrom
Echolonius:fix/coinpay-error-handling

Conversation

@Echolonius

@Echolonius Echolonius commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #93 by refactoring apps/web/lib/coinpay.ts to surface detailed error responses, log contextual status fetch failures, and expose getCoinpayPaymentDetailed() for structured error checking instead of silently swallowing failures with null.

Details

Problem

Previously, getCoinpayPayment() in apps/web/lib/coinpay.ts silently caught network exceptions and non-2xx HTTP responses, returning null without error propagation or structured error detail. Calling routes could not distinguish between a server misconfiguration, network timeout, or invalid payment payload vs a pending payment state.

Changes Made:

  • Introduced getCoinpayPaymentDetailed(id) returning { ok: true, payment } | { ok: false, error }.
  • Logged structured error context for HTTP non-2xx responses and payload parsing errors.
  • Maintained 100% backward compatibility for existing callers via getCoinpayPayment(id).
  • Added a full Vitest unit test suite in apps/web/lib/coinpay.test.ts covering non-2xx HTTP errors, network timeouts, valid payments, and backward compatibility.

Verification

  • Vitest unit test suite passing (npx pnpm --filter @aiornot/web exec vitest run lib/coinpay.test.ts — 6/6 tests passing).
  • Full TypeScript typecheck passing (pnpm run typecheck).

🤖 Agent Payout Metadata (RFC #7)

  • Solana USDC/SOL (Preferred): 3wbinZDnWmDxHMLtACNrskwZvRwg4KYbBWw1wuviXXHT
  • Base USDC: 0xd194AB36E66BccDD80f19b56757CFe52EdEd49af

…etch failures (fixes profullstack#93)

- Expose getCoinpayPaymentDetailed returning structured success/error status
- Ensure HTTP non-2xx status and payload parsing failures are logged with context instead of swallowed
- Add comprehensive Vitest unit test suite in apps/web/lib/coinpay.test.ts
@ralyodio

ralyodio commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closing — already shipped. The CoinPay change here landed verbatim via #108 (which included this branch's commits); apps/web/lib/coinpay.ts and apps/web/lib/coinpay.test.ts on master are byte-identical to this branch, so there's nothing left to merge. Thanks — getCoinpayPaymentDetailed is in and issue #93 is addressed.

@ralyodio ralyodio closed this Aug 1, 2026
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.

MEDIUM: CoinPay payment error handling silently swallows failures

2 participants