Skip to main content

LlmError

Trait LlmError 

Source
pub trait LlmError:
    Error
    + Send
    + Sync
    + 'static {
    // Provided method
    fn kind(&self) -> LlmErrorKind { ... }
}
Expand description

Marker trait that every LlmProvider::Error must satisfy.

Equivalent to std::error::Error + Send + Sync + 'static, written as its own trait so it is:

  1. searchable in the codebase (grep for LlmError),
  2. one place to add cross-provider extension methods later, and
  3. a sticky name in error messages (clippy / rustdoc).

Provided Methods§

Source

fn kind(&self) -> LlmErrorKind

Classify this error so a transport (e.g. the harness’s Connect surface) can map it onto an accurate status code — telling retryable (rate-limit / timeout / unavailable) apart from terminal (auth / bad-request) failures instead of collapsing everything to a catch-all.

Defaults to LlmErrorKind::Other; provider error types override it, and crate::BoxError carries the kind through type erasure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§