#[non_exhaustive]pub enum LlmError {
Network(String),
Auth(String),
RateLimited(String),
BadRequest {
status: u16,
body: String,
},
Server {
status: u16,
body: String,
},
Decode(String),
Config(String),
EmptyCompletion,
}Expand description
Error surface for text-generation adapters.
Marked #[non_exhaustive] so provider crates can grow their own
failure modes without a breaking change here.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Network(String)
TLS / TCP / DNS / timeout failure reaching the provider.
Auth(String)
Provider rejected credentials.
RateLimited(String)
Provider rate-limited the request.
BadRequest
4xx from the provider.
Server
5xx from the provider.
Decode(String)
Response decoder failed (malformed JSON, missing content field, …).
Config(String)
Adapter config invalid (bad URL, missing env var, etc.).
EmptyCompletion
Provider returned an empty completion.
Trait Implementations§
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()
Auto Trait Implementations§
impl Freeze for LlmError
impl RefUnwindSafe for LlmError
impl Send for LlmError
impl Sync for LlmError
impl Unpin for LlmError
impl UnsafeUnpin for LlmError
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