pub enum Error {
Show 18 variants
Api {
message: String,
error_type: String,
code: Option<String>,
},
ServerError {
message: String,
request_id: Option<String>,
retry_suggested: bool,
user_message: String,
},
BadGateway {
retry_after: Option<u64>,
status_code: u16,
},
ServiceUnavailable {
retry_after: Option<u64>,
retry_message: String,
},
GatewayTimeout {
retry_after: Option<u64>,
},
RateLimited {
retry_after: Option<u64>,
retry_message: String,
limit_type: Option<String>,
},
AuthenticationFailed {
message: String,
suggestion: String,
},
AuthorizationFailed {
message: String,
suggestion: String,
},
ClientError {
message: String,
status_code: u16,
field: Option<String>,
suggestion: Option<String>,
},
ContainerExpired {
message: String,
auto_handled: bool,
},
Http(Error),
HttpStatus(StatusCode),
Json(Error),
Stream(String),
InvalidApiKey,
ApiKeyNotFound,
ContextRecovery(String),
MaxRetriesExceeded {
attempts: u32,
},
}
Expand description
Error type for the crate
Variants§
Api
API error
ServerError
Server error (500 Internal Server Error)
Fields
BadGateway
Bad Gateway error (502)
Fields
Service Unavailable error (503)
GatewayTimeout
Gateway Timeout error (504)
RateLimited
Rate limiting error (429)
Fields
AuthenticationFailed
Authentication error (401)
AuthorizationFailed
Authorization error (403)
ClientError
Client error (400, 422)
Fields
ContainerExpired
Container expired error (special case of API error)
Http(Error)
HTTP error
HttpStatus(StatusCode)
HTTP status error (fallback for unhandled status codes)
Json(Error)
JSON error
Stream(String)
Stream error
InvalidApiKey
Invalid API key
ApiKeyNotFound
API key not found in environment
ContextRecovery(String)
Context recovery error
MaxRetriesExceeded
Maximum retry attempts exceeded
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_container_expired(&self) -> bool
pub fn is_container_expired(&self) -> bool
Returns true if this error indicates a container has expired
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Returns true if this error can be automatically recovered from
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if this is a transient error that should be retried
Sourcepub fn retry_after(&self) -> Option<u64>
pub fn retry_after(&self) -> Option<u64>
Returns the suggested retry delay in seconds
Sourcepub fn user_message(&self) -> String
pub fn user_message(&self) -> String
Returns a user-friendly error message
Sourcepub fn container_expired(message: impl Into<String>, auto_handled: bool) -> Self
pub fn container_expired(message: impl Into<String>, auto_handled: bool) -> Self
Creates a container expired error
Sourcepub fn server_error(
message: impl Into<String>,
request_id: Option<String>,
retry_suggested: bool,
) -> Self
pub fn server_error( message: impl Into<String>, request_id: Option<String>, retry_suggested: bool, ) -> Self
Creates a server error with retry suggestion
Sourcepub fn bad_gateway(retry_after: Option<u64>) -> Self
pub fn bad_gateway(retry_after: Option<u64>) -> Self
Creates a bad gateway error
Creates a service unavailable error
Sourcepub fn gateway_timeout(retry_after: Option<u64>) -> Self
pub fn gateway_timeout(retry_after: Option<u64>) -> Self
Creates a gateway timeout error