pub enum MppError {
Show 26 variants
AmountExceedsMax {
required: u128,
max: u128,
},
InvalidAmount(String),
InvalidConfig(String),
Http(String),
ChainIdMismatch {
expected: u64,
got: u64,
},
Json(Error),
UnsupportedPaymentMethod(String),
MissingHeader(String),
InvalidBase64Url(String),
MalformedCredential(Option<String>),
InvalidChallenge {
id: Option<String>,
reason: Option<String>,
},
VerificationFailed(Option<String>),
PaymentExpired(Option<String>),
PaymentRequired {
realm: Option<String>,
description: Option<String>,
},
InvalidPayload(Option<String>),
BadRequest(Option<String>),
InsufficientBalance(Option<String>),
InvalidSignature(Option<String>),
SignerMismatch(Option<String>),
AmountExceedsDeposit(Option<String>),
DeltaTooSmall(Option<String>),
ChannelNotFound(Option<String>),
ChannelClosed(Option<String>),
Io(Error),
InvalidUtf8(FromUtf8Error),
SystemTime(SystemTimeError),
}Variants§
AmountExceedsMax
Required amount exceeds user’s maximum allowed
InvalidAmount(String)
Invalid amount format
InvalidConfig(String)
Configuration is invalid
Http(String)
HTTP request/response error
ChainIdMismatch
Chain ID mismatch between challenge and provider
Json(Error)
JSON serialization/deserialization error
UnsupportedPaymentMethod(String)
Unsupported payment method
MissingHeader(String)
Missing required header
InvalidBase64Url(String)
Invalid base64url encoding
MalformedCredential(Option<String>)
Credential is malformed (invalid base64url, bad JSON structure).
InvalidChallenge
Challenge ID is unknown, expired, or already used.
VerificationFailed(Option<String>)
Payment proof is invalid or verification failed.
PaymentExpired(Option<String>)
Payment has expired.
PaymentRequired
No credential was provided but payment is required.
InvalidPayload(Option<String>)
Credential payload does not match the expected schema.
BadRequest(Option<String>)
Request is malformed or contains invalid parameters.
InsufficientBalance(Option<String>)
Insufficient balance in payment channel.
InvalidSignature(Option<String>)
Invalid cryptographic signature.
SignerMismatch(Option<String>)
Signer does not match expected address.
AmountExceedsDeposit(Option<String>)
Voucher amount exceeds channel deposit.
DeltaTooSmall(Option<String>)
Voucher delta is below the minimum threshold.
ChannelNotFound(Option<String>)
Payment channel not found.
ChannelClosed(Option<String>)
Payment channel has been closed.
Io(Error)
IO error
InvalidUtf8(FromUtf8Error)
Invalid UTF-8 in response
SystemTime(SystemTimeError)
System time error
Implementations§
Source§impl MppError
impl MppError
Sourcepub fn unsupported_method(method: &impl Display) -> Self
pub fn unsupported_method(method: &impl Display) -> Self
Create an unsupported payment method error
Sourcepub fn malformed_credential(reason: impl Into<String>) -> Self
pub fn malformed_credential(reason: impl Into<String>) -> Self
Create a malformed credential error.
Sourcepub fn malformed_credential_default() -> Self
pub fn malformed_credential_default() -> Self
Create a malformed credential error without a reason.
Sourcepub fn invalid_challenge_id(id: impl Into<String>) -> Self
pub fn invalid_challenge_id(id: impl Into<String>) -> Self
Create an invalid challenge error with ID.
Sourcepub fn invalid_challenge_reason(reason: impl Into<String>) -> Self
pub fn invalid_challenge_reason(reason: impl Into<String>) -> Self
Create an invalid challenge error with reason.
Sourcepub fn invalid_challenge(
id: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_challenge( id: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid challenge error with ID and reason.
Sourcepub fn invalid_challenge_default() -> Self
pub fn invalid_challenge_default() -> Self
Create an invalid challenge error without details.
Sourcepub fn verification_failed(reason: impl Into<String>) -> Self
pub fn verification_failed(reason: impl Into<String>) -> Self
Create a verification failed error.
Sourcepub fn verification_failed_default() -> Self
pub fn verification_failed_default() -> Self
Create a verification failed error without a reason.
Sourcepub fn payment_expired(expires: impl Into<String>) -> Self
pub fn payment_expired(expires: impl Into<String>) -> Self
Create a payment expired error with expiration timestamp.
Sourcepub fn payment_expired_default() -> Self
pub fn payment_expired_default() -> Self
Create a payment expired error without timestamp.
Sourcepub fn payment_required_realm(realm: impl Into<String>) -> Self
pub fn payment_required_realm(realm: impl Into<String>) -> Self
Create a payment required error with realm.
Sourcepub fn payment_required_description(description: impl Into<String>) -> Self
pub fn payment_required_description(description: impl Into<String>) -> Self
Create a payment required error with description.
Sourcepub fn payment_required(
realm: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn payment_required( realm: impl Into<String>, description: impl Into<String>, ) -> Self
Create a payment required error with realm and description.
Sourcepub fn payment_required_default() -> Self
pub fn payment_required_default() -> Self
Create a payment required error without details.
Sourcepub fn invalid_payload(reason: impl Into<String>) -> Self
pub fn invalid_payload(reason: impl Into<String>) -> Self
Create an invalid payload error.
Sourcepub fn invalid_payload_default() -> Self
pub fn invalid_payload_default() -> Self
Create an invalid payload error without a reason.
Sourcepub fn bad_request(reason: impl Into<String>) -> Self
pub fn bad_request(reason: impl Into<String>) -> Self
Create a bad request error.
Sourcepub fn bad_request_default() -> Self
pub fn bad_request_default() -> Self
Create a bad request error without a reason.
Sourcepub fn problem_type_suffix(&self) -> Option<&'static str>
pub fn problem_type_suffix(&self) -> Option<&'static str>
Returns the RFC 9457 problem type suffix if this is a payment problem.
Sourcepub fn is_payment_problem(&self) -> bool
pub fn is_payment_problem(&self) -> bool
Returns true if this error is an RFC 9457 payment problem.
Trait Implementations§
Source§impl Error for MppError
impl Error for MppError
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
use the Display impl or to_string()