pub enum Error {
Show 22 variants
Json(Error),
Api {
status_code: u16,
error_code: String,
message: String,
},
HttpTransport {
message: String,
status_code: Option<u16>,
},
RequestTimeout {
endpoint: String,
timeout_ms: u64,
},
Connection(String),
DnsResolution(String),
ResponseDeserialization {
format: String,
error: String,
response: String,
},
Authentication(String),
Authorization(String),
RateLimitExceeded {
retry_after_seconds: Option<u64>,
},
InvalidParameter {
parameter: String,
message: String,
},
ResourceNotFound {
resource_type: String,
identifier: String,
},
BusinessLogic {
operation: String,
reason: String,
},
Crypto(CryptoError),
Config(ConfigError),
Url(ParseError),
Hex(FromHexError),
Rlp(DecoderError),
Address(String),
ArrayConversion {
expected: usize,
actual: usize,
},
Validation {
field: String,
message: String,
},
Custom(String),
}Expand description
Main error type for the OneMoney SDK.
Variants§
Json(Error)
JSON serialization/deserialization error.
Api
API error returned by the server.
HttpTransport
HTTP transport error with optional status code.
RequestTimeout
Request timeout error.
Connection(String)
Connection error.
DnsResolution(String)
DNS resolution error.
ResponseDeserialization
Response deserialization error.
Authentication(String)
Authentication error.
Authorization(String)
Authorization error.
RateLimitExceeded
Rate limit exceeded.
InvalidParameter
Invalid request parameter.
ResourceNotFound
Resource not found.
BusinessLogic
Business logic error.
Crypto(CryptoError)
Cryptographic operation errors.
Config(ConfigError)
Client configuration errors.
Url(ParseError)
URL parsing error.
Hex(FromHexError)
Hex decoding error.
Rlp(DecoderError)
RLP encoding/decoding error.
Address(String)
Address parsing error.
ArrayConversion
Array conversion error.
Validation
Validation error for input parameters.
Custom(String)
Generic error with custom message.
Implementations§
Source§impl Error
impl Error
Sourcepub fn api(status_code: u16, error_code: String, message: String) -> Self
pub fn api(status_code: u16, error_code: String, message: String) -> Self
Create a new API error.
Sourcepub fn array_conversion(expected: usize, actual: usize) -> Self
pub fn array_conversion(expected: usize, actual: usize) -> Self
Create an array conversion error.
Sourcepub fn validation<T: Into<String>, U: Into<String>>(
field: T,
message: U,
) -> Self
pub fn validation<T: Into<String>, U: Into<String>>( field: T, message: U, ) -> Self
Create a validation error.
Sourcepub fn is_api_error(&self) -> bool
pub fn is_api_error(&self) -> bool
Check if this is an API error.
Sourcepub fn is_config_error(&self) -> bool
pub fn is_config_error(&self) -> bool
Check if this is a configuration error.
Sourcepub fn is_crypto_error(&self) -> bool
pub fn is_crypto_error(&self) -> bool
Check if this is a cryptographic error.
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Get the status code if this is an API error.
Sourcepub fn error_code(&self) -> Option<&str>
pub fn error_code(&self) -> Option<&str>
Get the error code if this is an API error.
Sourcepub fn http_transport<T: Into<String>>(
message: T,
status_code: Option<u16>,
) -> Self
pub fn http_transport<T: Into<String>>( message: T, status_code: Option<u16>, ) -> Self
Create an HTTP transport error.
Sourcepub fn request_timeout<T: Into<String>>(endpoint: T, timeout_ms: u64) -> Self
pub fn request_timeout<T: Into<String>>(endpoint: T, timeout_ms: u64) -> Self
Create a request timeout error.
Sourcepub fn connection<T: Into<String>>(message: T) -> Self
pub fn connection<T: Into<String>>(message: T) -> Self
Create a connection error.
Sourcepub fn dns_resolution<T: Into<String>>(message: T) -> Self
pub fn dns_resolution<T: Into<String>>(message: T) -> Self
Create a DNS resolution error.
Sourcepub fn response_deserialization<A: Into<String>, B: Into<String>, C: Into<String>>(
format: A,
error: B,
response: C,
) -> Self
pub fn response_deserialization<A: Into<String>, B: Into<String>, C: Into<String>>( format: A, error: B, response: C, ) -> Self
Create a response deserialization error.
Sourcepub fn authentication<T: Into<String>>(message: T) -> Self
pub fn authentication<T: Into<String>>(message: T) -> Self
Create an authentication error.
Create an authorization error.
Sourcepub fn rate_limit_exceeded(retry_after_seconds: Option<u64>) -> Self
pub fn rate_limit_exceeded(retry_after_seconds: Option<u64>) -> Self
Create a rate limit exceeded error.
Sourcepub fn invalid_parameter<A: Into<String>, B: Into<String>>(
parameter: A,
message: B,
) -> Self
pub fn invalid_parameter<A: Into<String>, B: Into<String>>( parameter: A, message: B, ) -> Self
Create an invalid parameter error.