pub enum RsllmError {
Configuration {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Provider {
provider: String,
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Network {
message: String,
status_code: Option<u16>,
source: Option<Box<dyn Error + Send + Sync>>,
},
Authentication {
message: String,
},
RateLimit {
message: String,
retry_after: Option<Duration>,
},
Api {
provider: String,
message: String,
code: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Serialization {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Streaming {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Timeout {
operation: String,
timeout_ms: u64,
},
Validation {
field: String,
message: String,
},
NotFound {
resource: String,
},
InvalidState {
message: String,
},
}Expand description
Comprehensive error types for RSLLM operations
Variants§
Configuration
Configuration errors
Provider
Provider-specific errors
Network
HTTP/Network errors
Authentication
Authentication errors
RateLimit
Rate limiting errors
Api
API errors from providers
Serialization
Serialization/Deserialization errors
Streaming
Streaming errors
Timeout
Timeout errors
Validation
Validation errors
NotFound
Resource not found errors
InvalidState
Invalid state errors
Implementations§
Source§impl RsllmError
impl RsllmError
Sourcepub fn configuration(message: impl Into<String>) -> Self
pub fn configuration(message: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn configuration_with_source(
message: impl Into<String>,
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn configuration_with_source( message: impl Into<String>, source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Self
Create a configuration error with source
Sourcepub fn provider(provider: impl Into<String>, message: impl Into<String>) -> Self
pub fn provider(provider: impl Into<String>, message: impl Into<String>) -> Self
Create a provider error
Sourcepub fn provider_with_source(
provider: impl Into<String>,
message: impl Into<String>,
source: impl Into<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn provider_with_source( provider: impl Into<String>, message: impl Into<String>, source: impl Into<Box<dyn Error + Send + Sync>>, ) -> Self
Create a provider error with source
Sourcepub fn network_with_status(message: impl Into<String>, status_code: u16) -> Self
pub fn network_with_status(message: impl Into<String>, status_code: u16) -> Self
Create a network error with status code
Sourcepub fn authentication(message: impl Into<String>) -> Self
pub fn authentication(message: impl Into<String>) -> Self
Create an authentication error
Sourcepub fn rate_limit(
message: impl Into<String>,
retry_after: Option<Duration>,
) -> Self
pub fn rate_limit( message: impl Into<String>, retry_after: Option<Duration>, ) -> Self
Create a rate limit error
Sourcepub fn api(
provider: impl Into<String>,
message: impl Into<String>,
code: impl Into<String>,
) -> Self
pub fn api( provider: impl Into<String>, message: impl Into<String>, code: impl Into<String>, ) -> Self
Create an API error
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Create a serialization error
Sourcepub fn validation(field: impl Into<String>, message: impl Into<String>) -> Self
pub fn validation(field: impl Into<String>, message: impl Into<String>) -> Self
Create a validation error
Sourcepub fn invalid_state(message: impl Into<String>) -> Self
pub fn invalid_state(message: impl Into<String>) -> Self
Create an invalid state error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if error is retryable
Sourcepub fn retry_delay(&self) -> Option<Duration>
pub fn retry_delay(&self) -> Option<Duration>
Get retry delay if applicable
Trait Implementations§
Source§impl Debug for RsllmError
impl Debug for RsllmError
Source§impl Display for RsllmError
impl Display for RsllmError
Source§impl Error for RsllmError
impl Error for RsllmError
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 From<Elapsed> for RsllmError
impl From<Elapsed> for RsllmError
Source§impl From<Error> for RsllmError
impl From<Error> for RsllmError
Source§impl From<Error> for RsllmError
impl From<Error> for RsllmError
Source§impl From<ParseError> for RsllmError
impl From<ParseError> for RsllmError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RsllmError
impl !RefUnwindSafe for RsllmError
impl Send for RsllmError
impl Sync for RsllmError
impl Unpin for RsllmError
impl !UnwindSafe for RsllmError
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