Skip to main content

x402/
error.rs

1//! Error types for x402 payment operations.
2//!
3//! [`X402Error`] covers signature failures, chain interaction errors,
4//! invalid payments, unsupported schemes, configuration issues, and HTTP errors.
5
6use thiserror::Error;
7
8/// Errors returned by x402 operations.
9#[derive(Debug, Error)]
10pub enum X402Error {
11    #[error("signature error: {0}")]
12    SignatureError(String),
13
14    #[error("chain error: {0}")]
15    ChainError(String),
16
17    #[error("invalid payment: {0}")]
18    InvalidPayment(String),
19
20    #[error("unsupported scheme: {0}")]
21    UnsupportedScheme(String),
22
23    #[error("config error: {0}")]
24    ConfigError(String),
25
26    #[error("http error: {0}")]
27    HttpError(String),
28
29    #[error("serialization error: {0}")]
30    SerdeError(#[from] serde_json::Error),
31}