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()
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.