pub enum ErrorClass {
RateLimit,
Overloaded,
Server,
Timeout,
Auth,
ContextWindow,
ContentPolicy,
Malformed,
NotFound,
BillingQuota,
Unknown,
}Expand description
Provider-agnostic error class.
Variants§
RateLimit
HTTP 429 / rate_limit_error / ThrottlingException. Retry with
backoff.
Overloaded
Provider is overloaded (Anthropic overloaded_error,
ServiceUnavailableException). Retry with backoff.
Server
Generic 5xx. Retry with backoff.
Timeout
Request timed out at the server or transport. Retry.
Auth
HTTP 401 / 403. Do not retry. Caller must fix credentials.
ContextWindow
Input exceeded the model’s context window
(context_length_exceeded, ValidationException with token
count). Do not retry without shrinking the prompt.
ContentPolicy
Output blocked by a content policy filter. Do not retry.
Malformed
400 with a parser-level error in the request body. Do not retry without fixing the request.
NotFound
404 (model not found, etc.). Do not retry.
BillingQuota
HTTP 402 / insufficient_quota / BillingException. Do not
retry until the account is funded.
Unknown
Anything we did not recognize. Caller decides what to do.
Implementations§
Source§impl ErrorClass
impl ErrorClass
Sourcepub fn is_retriable(self) -> bool
pub fn is_retriable(self) -> bool
True for classes that are worth retrying with backoff.
Retriable: RateLimit,
Overloaded, Server,
Timeout. Everything else is terminal.
Trait Implementations§
Source§impl Clone for ErrorClass
impl Clone for ErrorClass
Source§fn clone(&self) -> ErrorClass
fn clone(&self) -> ErrorClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorClass
impl Debug for ErrorClass
Source§impl Hash for ErrorClass
impl Hash for ErrorClass
Source§impl PartialEq for ErrorClass
impl PartialEq for ErrorClass
Source§fn eq(&self, other: &ErrorClass) -> bool
fn eq(&self, other: &ErrorClass) -> bool
self and other values to be equal, and is used by ==.