pub enum X402Error {
Show 28 variants
Json(Error),
Http(Error),
Base64(DecodeError),
InvalidPaymentPayload {
message: String,
},
InvalidPaymentRequirements {
message: String,
},
PaymentVerificationFailed {
reason: String,
},
PaymentSettlementFailed {
reason: String,
},
FacilitatorError {
message: String,
},
Crypto(Box<dyn Error + Send + Sync>),
InvalidSignature {
message: String,
},
InvalidAuthorization {
message: String,
},
NetworkNotSupported {
network: String,
},
NetworkError {
message: String,
},
InvalidNetwork {
message: String,
},
SchemeNotSupported {
scheme: String,
},
InsufficientFunds,
AuthorizationExpired,
AuthorizationNotYetValid,
InvalidAmount {
expected: String,
got: String,
},
RecipientMismatch {
expected: String,
got: String,
},
Unexpected {
message: String,
},
Config {
message: String,
},
Timeout,
Io(Error),
ParseInt(ParseIntError),
FromHex(FromHexError),
FromStrRadix(FromStrRadixErr),
AddrParse(AddrParseError),
}Expand description
Main error type for x402 operations
Variants§
Json(Error)
JSON serialization/deserialization error
Http(Error)
HTTP client error
Base64(DecodeError)
Base64 encoding/decoding error
InvalidPaymentPayload
Invalid payment payload
InvalidPaymentRequirements
Invalid payment requirements
PaymentVerificationFailed
Payment verification failed
PaymentSettlementFailed
Payment settlement failed
FacilitatorError
Facilitator communication error
Crypto(Box<dyn Error + Send + Sync>)
Cryptographic error
InvalidSignature
Invalid signature
InvalidAuthorization
Invalid authorization
NetworkNotSupported
Network not supported
NetworkError
Network error (connection, RPC, etc.)
InvalidNetwork
Invalid network configuration
SchemeNotSupported
Scheme not supported
InsufficientFunds
Insufficient funds
AuthorizationExpired
Authorization expired
AuthorizationNotYetValid
Authorization not yet valid
InvalidAmount
Invalid amount
RecipientMismatch
Recipient mismatch
Unexpected
Unexpected error
Config
Configuration error
Timeout
Timeout error
Io(Error)
IO error
ParseInt(ParseIntError)
Parse integer error
FromHex(FromHexError)
From hex error
FromStrRadix(FromStrRadixErr)
From str radix error
AddrParse(AddrParseError)
Address parse error
Implementations§
Source§impl X402Error
impl X402Error
Sourcepub fn invalid_payment_payload(message: impl Into<String>) -> Self
pub fn invalid_payment_payload(message: impl Into<String>) -> Self
Create an invalid payment payload error
Sourcepub fn invalid_payment_requirements(message: impl Into<String>) -> Self
pub fn invalid_payment_requirements(message: impl Into<String>) -> Self
Create an invalid payment requirements error
Sourcepub fn payment_verification_failed(reason: impl Into<String>) -> Self
pub fn payment_verification_failed(reason: impl Into<String>) -> Self
Create a payment verification failed error
Sourcepub fn payment_settlement_failed(reason: impl Into<String>) -> Self
pub fn payment_settlement_failed(reason: impl Into<String>) -> Self
Create a payment settlement failed error
Sourcepub fn facilitator_error(message: impl Into<String>) -> Self
pub fn facilitator_error(message: impl Into<String>) -> Self
Create a facilitator error
Sourcepub fn invalid_signature(message: impl Into<String>) -> Self
pub fn invalid_signature(message: impl Into<String>) -> Self
Create an invalid signature error
Create an invalid authorization error
Sourcepub fn network_error(message: impl Into<String>) -> Self
pub fn network_error(message: impl Into<String>) -> Self
Create a network error
Sourcepub fn invalid_network(message: impl Into<String>) -> Self
pub fn invalid_network(message: impl Into<String>) -> Self
Create an invalid network error
Sourcepub fn unexpected(message: impl Into<String>) -> Self
pub fn unexpected(message: impl Into<String>) -> Self
Create an unexpected error
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Get HTTP status code for this error
Sourcepub fn error_type(&self) -> &'static str
pub fn error_type(&self) -> &'static str
Get error type string
Trait Implementations§
Source§impl Error for X402Error
impl Error for X402Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<&X402Error> for ErrorResponse
impl From<&X402Error> for ErrorResponse
Source§impl From<AddrParseError> for X402Error
impl From<AddrParseError> for X402Error
Source§fn from(source: AddrParseError) -> Self
fn from(source: AddrParseError) -> Self
Source§impl From<DecodeError> for X402Error
impl From<DecodeError> for X402Error
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Source§impl From<FromHexError> for X402Error
impl From<FromHexError> for X402Error
Source§fn from(source: FromHexError) -> Self
fn from(source: FromHexError) -> Self
Source§impl From<FromStrRadixErr> for X402Error
impl From<FromStrRadixErr> for X402Error
Source§fn from(source: FromStrRadixErr) -> Self
fn from(source: FromStrRadixErr) -> Self
Source§impl From<ParseIntError> for X402Error
impl From<ParseIntError> for X402Error
Source§fn from(source: ParseIntError) -> Self
fn from(source: ParseIntError) -> Self
Auto Trait Implementations§
impl Freeze for X402Error
impl !RefUnwindSafe for X402Error
impl Send for X402Error
impl Sync for X402Error
impl Unpin for X402Error
impl !UnwindSafe for X402Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.