#[non_exhaustive]pub enum AmberError {
Http(Error),
RateLimitExceeded(u64),
RateLimitExhausted {
attempts: u32,
retry_after: u64,
},
UnexpectedStatus {
status: u16,
body: String,
},
}Expand description
Error types that can occur when using the Amber API client.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Http(Error)
HTTP request error.
RateLimitExceeded(u64)
Rate limit exceeded. Contains the number of seconds to wait.
This error is returned when the API rate limit is hit and automatic
retries are disabled via retry_on_rate_limit(false).
RateLimitExhausted
Rate limit exceeded and max retries exhausted.
This error is returned when the API rate limit is hit and the maximum
number of retry attempts has been exhausted. The attempts field shows
how many retries were attempted, and retry_after shows the suggested
wait time in seconds before trying again.
Fields
UnexpectedStatus
Unexpected HTTP status code.
This error is returned when the API returns a non-2xx status code that is not specifically handled (e.g., not a rate limit error).
Trait Implementations§
Source§impl Debug for AmberError
impl Debug for AmberError
Source§impl Display for AmberError
impl Display for AmberError
Source§impl Error for AmberError
impl Error for AmberError
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
Auto Trait Implementations§
impl Freeze for AmberError
impl !RefUnwindSafe for AmberError
impl Send for AmberError
impl Sync for AmberError
impl Unpin for AmberError
impl !UnwindSafe for AmberError
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.