pub enum ProviderError {
Authentication {
message: String,
},
Transport {
message: String,
},
RateLimit {
message: String,
retry_after: Option<u64>,
},
MalformedResponse {
message: String,
},
InvalidRequest {
message: String,
},
Model {
message: String,
},
General {
message: String,
},
}Expand description
Structured provider errors
Variants§
Authentication
Authentication failure (invalid or missing API key)
Transport
Transport/connection failure
RateLimit
Rate limit exceeded
MalformedResponse
Malformed response from provider
InvalidRequest
Invalid request parameters
Model
Model not found or unsupported
General
General provider error (catch-all)
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn rate_limit<S: Into<String>>(message: S, retry_after: Option<u64>) -> Self
pub fn rate_limit<S: Into<String>>(message: S, retry_after: Option<u64>) -> Self
Create a rate limit error
Sourcepub fn invalid_request<S: Into<String>>(message: S) -> Self
pub fn invalid_request<S: Into<String>>(message: S) -> Self
Create an invalid request error
Sourcepub fn is_authentication(&self) -> bool
pub fn is_authentication(&self) -> bool
Check if this is an authentication error
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Check if this is a rate limit error
Sourcepub fn is_transport(&self) -> bool
pub fn is_transport(&self) -> bool
Check if this is a transport error
Sourcepub fn retry_after(&self) -> Option<u64>
pub fn retry_after(&self) -> Option<u64>
Get retry-after duration if available
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 (const: unstable) · 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<'de> Deserialize<'de> for ProviderError
impl<'de> Deserialize<'de> for ProviderError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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()
Source§impl PartialEq for ProviderError
impl PartialEq for ProviderError
Source§fn eq(&self, other: &ProviderError) -> bool
fn eq(&self, other: &ProviderError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ProviderError
impl Serialize for ProviderError
impl StructuralPartialEq for ProviderError
Auto Trait Implementations§
impl Freeze for ProviderError
impl RefUnwindSafe for ProviderError
impl Send for ProviderError
impl Sync for ProviderError
impl Unpin for ProviderError
impl UnsafeUnpin 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