pub enum LLMError {
Authentication {
message: String,
metadata: Option<Box<LLMErrorMetadata>>,
},
RateLimit {
metadata: Option<Box<LLMErrorMetadata>>,
},
InvalidRequest {
message: String,
metadata: Option<Box<LLMErrorMetadata>>,
},
Network {
message: String,
metadata: Option<Box<LLMErrorMetadata>>,
},
Provider {
message: String,
metadata: Option<Box<LLMErrorMetadata>>,
},
}Expand description
LLM error types with optional provider metadata
Variants§
Authentication
RateLimit
Fields
§
metadata: Option<Box<LLMErrorMetadata>>InvalidRequest
Network
Provider
Implementations§
Source§impl LLMError
impl LLMError
Sourcepub fn metadata(&self) -> Option<&LLMErrorMetadata>
pub fn metadata(&self) -> Option<&LLMErrorMetadata>
Borrow the provider metadata carried by this error, if any.
Every variant stores an Option<Box<LLMErrorMetadata>>. This is the
single accessor so callers that only need the metadata (retry-after,
provider code, raw body, misconfiguration detection) never re-spell the
five-variant match — a match that is easy to drift when a variant is
added.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LLMError
impl<'de> Deserialize<'de> for LLMError
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 Error for LLMError
impl Error for LLMError
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 From<&LLMError> for ErrorCategory
impl From<&LLMError> for ErrorCategory
Auto Trait Implementations§
impl Forget for LLMError
impl Freeze for LLMErrorwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LLMErrorMetadata is !null: Freeze,
PhantomData<LLMErrorMetadata>: Freeze,
impl Move for LLMError
impl RefUnwindSafe for LLMError
impl Send for LLMError
impl Sync for LLMError
impl Unpin for LLMError
impl UnsafeUnpin for LLMErrorwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LLMErrorMetadata is !null: UnsafeUnpin,
PhantomData<LLMErrorMetadata>: UnsafeUnpin,
impl UnwindSafe for LLMError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more