pub enum LlmError {
InvalidInput(String),
Cancelled,
DeadlineExceeded,
CircuitOpen,
Transport(Error),
Api {
status: u16,
body: String,
},
Decode(Error),
StreamProtocol(String),
InvalidUtf8(FromUtf8Error),
}Expand description
Everything that can go wrong on the way to a completion.
Mirrors the failure modes of the Python llm_completion wrapper, but where
that returned None and swallowed the cause, we keep a typed error so the
caller decides how to degrade.
Variants§
InvalidInput(String)
Invalid, unsupported, or unauthorized input rejected before model dispatch. Adapters must not use this variant after sending a provider request.
Cancelled
Caller cancelled the provider attempt.
DeadlineExceeded
Caller deadline elapsed before the provider attempt settled.
CircuitOpen
Circuit breaker is open — we fail fast without hitting the provider.
Transport(Error)
Transport-level failure (connection, TLS, timeout).
Api
Provider returned a non-2xx status.
Decode(Error)
Response body could not be decoded into the expected shape.
StreamProtocol(String)
A streaming response violated the SSE completion contract.
InvalidUtf8(FromUtf8Error)
A streaming response contained bytes that were not valid UTF-8.
Implementations§
Trait Implementations§
Source§impl Error for LlmError
impl Error for LlmError
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()