pub enum AiError {
Show 14 variants
Provider(String),
Network(Error),
Serialization(Error),
Authentication(String),
RateLimit(String),
InvalidRequest(String),
ModelNotFound(String),
Timeout(String),
Plugin {
plugin: String,
message: String,
},
Layer {
layer: String,
message: String,
},
Configuration(String),
Stream(String),
Unsupported(String),
Other(String),
}Expand description
The main error type for AI operations.
Variants§
Provider(String)
Provider-specific errors
Network(Error)
Network-related errors
Serialization(Error)
Serialization/deserialization errors
Authentication(String)
Authentication errors
RateLimit(String)
Rate limit errors
InvalidRequest(String)
Invalid request errors
ModelNotFound(String)
Model not found errors
Timeout(String)
Timeout errors
Plugin
Plugin errors
Layer
Layer errors
Configuration(String)
Configuration errors
Stream(String)
Stream errors
Unsupported(String)
Unsupported operation errors
Other(String)
Generic errors
Implementations§
Source§impl AiError
impl AiError
Sourcepub fn authentication(msg: impl Into<String>) -> Self
pub fn authentication(msg: impl Into<String>) -> Self
Create an authentication error
Sourcepub fn rate_limit(msg: impl Into<String>) -> Self
pub fn rate_limit(msg: impl Into<String>) -> Self
Create a rate limit error
Sourcepub fn invalid_request(msg: impl Into<String>) -> Self
pub fn invalid_request(msg: impl Into<String>) -> Self
Create an invalid request error
Sourcepub fn model_not_found(msg: impl Into<String>) -> Self
pub fn model_not_found(msg: impl Into<String>) -> Self
Create a model not found error
Sourcepub fn plugin(plugin: impl Into<String>, message: impl Into<String>) -> Self
pub fn plugin(plugin: impl Into<String>, message: impl Into<String>) -> Self
Create a plugin error
Sourcepub fn layer(layer: impl Into<String>, message: impl Into<String>) -> Self
pub fn layer(layer: impl Into<String>, message: impl Into<String>) -> Self
Create a layer error
Sourcepub fn configuration(msg: impl Into<String>) -> Self
pub fn configuration(msg: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn unsupported(msg: impl Into<String>) -> Self
pub fn unsupported(msg: impl Into<String>) -> Self
Create an unsupported operation error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this is a retryable error
Trait Implementations§
Source§impl Error for AiError
impl Error for AiError
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 AiError
impl !RefUnwindSafe for AiError
impl Send for AiError
impl Sync for AiError
impl Unpin for AiError
impl !UnwindSafe for AiError
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