pub enum ProviderError {
Timeout,
RateLimit {
retry_after_secs: Option<u64>,
},
ContextOverflow {
tokens: usize,
},
InvalidResponse {
message: String,
},
ServiceUnavailable {
message: String,
},
AuthenticationFailed,
JsonError {
message: String,
},
NetworkError {
message: String,
},
InvalidRequest {
message: String,
},
}Expand description
Unified error type for all LLM providers.
TigerStyle: Explicit variants for all failure modes.
Variants§
Timeout
Request timed out
RateLimit
Rate limit exceeded
ContextOverflow
Context/prompt too long
InvalidResponse
Invalid response from provider
Service unavailable
AuthenticationFailed
Authentication failed
JsonError
JSON serialization/deserialization error
NetworkError
Network error
InvalidRequest
Invalid request parameters
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn rate_limit(retry_after_secs: Option<u64>) -> Self
pub fn rate_limit(retry_after_secs: Option<u64>) -> Self
Create a rate limit error.
Sourcepub fn context_overflow(tokens: usize) -> Self
pub fn context_overflow(tokens: usize) -> Self
Create a context overflow error.
Sourcepub fn invalid_response(message: impl Into<String>) -> Self
pub fn invalid_response(message: impl Into<String>) -> Self
Create an invalid response error.
Create a service unavailable error.
Sourcepub fn json_error(message: impl Into<String>) -> Self
pub fn json_error(message: impl Into<String>) -> Self
Create a JSON error.
Sourcepub fn network_error(message: impl Into<String>) -> Self
pub fn network_error(message: impl Into<String>) -> Self
Create a network error.
Sourcepub fn invalid_request(message: impl Into<String>) -> Self
pub fn invalid_request(message: impl Into<String>) -> Self
Create an invalid request error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Trait Implementations§
Source§impl Clone for ProviderError
impl Clone for ProviderError
Source§fn clone(&self) -> ProviderError
fn clone(&self) -> ProviderError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProviderError
impl Debug for ProviderError
Source§impl Display for ProviderError
impl Display for ProviderError
Source§impl Error for ProviderError
impl Error for ProviderError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ProviderError
impl RefUnwindSafe for ProviderError
impl Send for ProviderError
impl Sync for ProviderError
impl Unpin for ProviderError
impl UnwindSafe for ProviderError
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
Mutably borrows from an owned value. Read more