pub enum ProviderError {
ApiError {
status: u16,
message: String,
},
RateLimitExceeded {
provider_id: String,
},
NetworkError(String),
InvalidData(String),
NotFound(String),
AuthenticationFailed(String),
ProviderUnavailable(String),
SerializationError(String),
InvalidConfiguration(String),
Timeout {
timeout_ms: u64,
},
Other(String),
}Expand description
Errors that can occur during provider operations
These errors cover common failure modes across all provider types, including network errors, API errors, authentication failures, and rate limiting.
Variants§
ApiError
Provider API returned an error response
RateLimitExceeded
Rate limit exceeded for this provider
NetworkError(String)
Network error occurred during communication with provider
InvalidData(String)
Invalid or malformed data received from provider
NotFound(String)
Requested resource not found
AuthenticationFailed(String)
Authentication or authorization failed
Provider is temporarily unavailable
SerializationError(String)
Serialization/deserialization error
InvalidConfiguration(String)
Invalid configuration
Timeout
Operation timeout
Other(String)
General error with custom message
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn rate_limit(provider_id: impl Into<String>) -> Self
pub fn rate_limit(provider_id: impl Into<String>) -> Self
Create a rate limit error
Sourcepub fn invalid_data(message: impl Into<String>) -> Self
pub fn invalid_data(message: impl Into<String>) -> Self
Create an invalid data error
Sourcepub fn auth_failed(message: impl Into<String>) -> Self
pub fn auth_failed(message: impl Into<String>) -> Self
Create an authentication error
Create a provider unavailable error
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Check if this is a retriable error
Returns true for errors that may succeed on retry (network errors, timeouts,
provider unavailable), and false for permanent errors (authentication, not found).
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&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
Trait Implementations§
Source§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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()