Skip to main content

Module error_reason

Module error_reason 

Source
Expand description

Machine-readable error codes used in x402 verify/settle responses.

Aligned with the x402 v2 specification §9 “Error Handling” and the cross-SDK conventions established by the Go and TypeScript reference implementations. When the wire emits an unknown code it round-trips losslessly via ErrorReason::Custom.

§Categories

  • Spec §9 standard codes: 15 canonical reasons every facilitator MUST recognise (insufficient_funds, invalid_payload, …).
  • Cross-chain reserved codes: pragmatic codes used across SDKs but not enumerated in §9 (duplicate_settlement, nonce_already_used, permit2_allowance_required).
  • Upto scheme codes: reserved by schemes/upto/scheme_upto_evm.md.
  • SVM-prefixed codes: chain-specific diagnostics emitted by the Solana facilitator.
  • Custom(CompactString): catch-all preserving any unknown code as received on the wire so clients never lose information.

Structs§

PaymentProblem
A structured payment-problem record returned through wire boundaries.

Enums§

ErrorReason
Canonical error code returned on the wire when a payment fails.

Traits§

AsPaymentProblem
Trait for converting errors into PaymentProblems.