pub enum Error {
Transport(String),
Serde(Error),
Auth(String),
RateLimit {
retry_after_ms: Option<u64>,
},
BadRequest(String),
Exchange(String),
Timeout,
Decode(String),
Http {
status: u16,
message: String,
},
UrlParse(ParseError),
Io(Error),
}Expand description
Error type for Coinbase operations.
Variants§
Transport(String)
Transport layer errors (network, connection issues).
Serde(Error)
JSON serialization/deserialization errors.
Auth(String)
Authentication errors (invalid key, expired JWT).
RateLimit
Rate limiting errors.
BadRequest(String)
Bad request errors (client-side invalid payload).
Exchange(String)
Exchange-specific errors from Coinbase server.
Timeout
Request timeout.
Decode(String)
Message decoding/parsing errors.
Http
HTTP errors with status code.
UrlParse(ParseError)
URL parsing errors.
Io(Error)
Standard IO errors.
Implementations§
Source§impl Error
impl Error
Sourcepub fn rate_limit(retry_after_ms: Option<u64>) -> Self
pub fn rate_limit(retry_after_ms: Option<u64>) -> Self
Creates a rate limit error.
Sourcepub fn bad_request(msg: impl Into<String>) -> Self
pub fn bad_request(msg: impl Into<String>) -> Self
Creates a bad request error.
Sourcepub fn from_http_status(status: u16, body: &[u8]) -> Self
pub fn from_http_status(status: u16, body: &[u8]) -> Self
Creates an error from HTTP status code and body.
Sourcepub fn from_reqwest(error: ReqwestError) -> Self
pub fn from_reqwest(error: ReqwestError) -> Self
Maps reqwest errors to appropriate error types.
Sourcepub fn from_http_client(error: HttpClientError) -> Self
pub fn from_http_client(error: HttpClientError) -> Self
Maps HTTP client errors to appropriate error types.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if the error is retryable.
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true if the error is due to rate limiting.
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Returns true if the error is due to authentication.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()