pub enum AixError {
Transport {
source: String,
context: String,
},
Provider {
provider: String,
code: Option<String>,
message: String,
status: Option<u16>,
},
RateLimit {
provider: String,
retry_after: Option<Duration>,
message: String,
},
Serialization {
source: String,
context: String,
},
Config {
message: String,
},
Stream {
message: String,
source: Option<String>,
},
Safety {
provider: String,
category: String,
message: String,
},
Auth {
provider: String,
message: String,
},
Timeout {
operation: String,
duration: Duration,
},
Other {
message: String,
source: Option<String>,
},
}Expand description
Unified error type for all AIX operations.
Variants§
Transport
Transport layer errors (network, DNS, etc.)
Provider
Provider-specific errors (API errors, validation, etc.)
Fields
RateLimit
Rate limiting errors
Fields
Serialization
Serialization/deserialization errors
Fields
Config
Configuration errors
Stream
Streaming-related errors
Fields
Safety
Safety/content policy violations
Fields
Auth
Authentication/authorization errors
Fields
Timeout
Timeout errors
Fields
Other
Catch-all for other errors
Implementations§
Source§impl AixError
impl AixError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Returns true if the error warrants a retry attempt.
Sourcepub fn transport<S: Into<String>, C: Into<String>>(
source: S,
context: C,
) -> Self
pub fn transport<S: Into<String>, C: Into<String>>( source: S, context: C, ) -> Self
Create a new transport error.
Sourcepub fn provider<P: Into<String>, M: Into<String>>(
provider: P,
message: M,
) -> Self
pub fn provider<P: Into<String>, M: Into<String>>( provider: P, message: M, ) -> Self
Create a new provider error.
Sourcepub fn provider_with_details<P: Into<String>, M: Into<String>, C: Into<String>>(
provider: P,
message: M,
status: u16,
code: C,
) -> Self
pub fn provider_with_details<P: Into<String>, M: Into<String>, C: Into<String>>( provider: P, message: M, status: u16, code: C, ) -> Self
Create a new provider error with status and code.
Sourcepub fn rate_limit<P: Into<String>, M: Into<String>>(
provider: P,
message: M,
) -> Self
pub fn rate_limit<P: Into<String>, M: Into<String>>( provider: P, message: M, ) -> Self
Create a new rate limit error.
Sourcepub fn rate_limit_with_retry<P: Into<String>, M: Into<String>>(
provider: P,
message: M,
retry_after: Duration,
) -> Self
pub fn rate_limit_with_retry<P: Into<String>, M: Into<String>>( provider: P, message: M, retry_after: Duration, ) -> Self
Create a new rate limit error with retry after.
Sourcepub fn serialization<S: Into<String>, C: Into<String>>(
source: S,
context: C,
) -> Self
pub fn serialization<S: Into<String>, C: Into<String>>( source: S, context: C, ) -> Self
Create a new serialization error.
Sourcepub fn stream_with_source<M: Into<String>, S: Into<String>>(
message: M,
source: S,
) -> Self
pub fn stream_with_source<M: Into<String>, S: Into<String>>( message: M, source: S, ) -> Self
Create a new stream error with source.
Sourcepub fn safety<P: Into<String>, C: Into<String>, M: Into<String>>(
provider: P,
category: C,
message: M,
) -> Self
pub fn safety<P: Into<String>, C: Into<String>, M: Into<String>>( provider: P, category: C, message: M, ) -> Self
Create a new safety error.
Sourcepub fn auth<P: Into<String>, M: Into<String>>(provider: P, message: M) -> Self
pub fn auth<P: Into<String>, M: Into<String>>(provider: P, message: M) -> Self
Create a new auth error.
Trait Implementations§
Source§impl Error for AixError
impl Error for AixError
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()