Available on crate feature
server only.Expand description
Maps x402 error reasons to HTTP status codes.
Per x402 v2 §HTTP transport error mapping. The default status for a
payment failure is 402 Payment Required; a few reasons use other
statuses to signal out-of-band preconditions:
ErrorReason | HTTP status |
|---|---|
Permit2AllowanceRequired | 412 Precondition Failed |
| anything else | 402 Payment Required |
Functions§
- reason_
to_ status - Returns the HTTP status corresponding to an
ErrorReason.