pub enum Error {
Transport(Error),
Api {
status: u16,
code: Option<ErrorCode>,
message: String,
request_id: Option<String>,
retry_after: Option<Duration>,
details: Option<Value>,
},
BudgetExceeded {
message: String,
affected_scopes: Vec<String>,
retry_after: Option<Duration>,
request_id: Option<String>,
},
Deserialization(Error),
Config(String),
Validation(String),
}Expand description
The error type for all Cycles client operations.
Variants§
Transport(Error)
HTTP transport error (network failure, timeout, DNS, etc.).
Api
The server returned an error response.
Fields
BudgetExceeded
Budget is insufficient for the requested operation (HTTP 409).
Fields
Deserialization(Error)
Failed to deserialize the response body.
Config(String)
Invalid client configuration.
Validation(String)
Invalid request parameters (caught before sending).
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if the error is retryable.
Transport errors and server errors (5xx) are generally retryable. Budget exceeded errors are not retryable unless the server suggests a retry delay.
Sourcepub fn is_budget_exceeded(&self) -> bool
pub fn is_budget_exceeded(&self) -> bool
Returns true if this is a budget exceeded error.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
Returns the suggested retry delay, if any.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the server-assigned request ID, if available.
Sourcepub fn error_code(&self) -> Option<ErrorCode>
pub fn error_code(&self) -> Option<ErrorCode>
Returns the error code, if available.
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()
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
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.