Skip to main content

agentic_llm/
error.rs

1//! LLM error types.
2
3use thiserror::Error;
4
5/// Errors that can occur when interacting with LLM providers.
6#[derive(Error, Debug)]
7pub enum LLMError {
8    /// API error from the provider
9    #[error("API error: {0}")]
10    ApiError(String),
11
12    /// Network/connection error
13    #[error("Connection error: {0}")]
14    ConnectionError(String),
15
16    /// Authentication error
17    #[error("Authentication failed: {0}")]
18    AuthenticationError(String),
19
20    /// Rate limit exceeded
21    #[error("Rate limit exceeded: {0}")]
22    RateLimitError(String),
23
24    /// Empty response from provider
25    #[error("Empty response from LLM")]
26    EmptyResponse,
27
28    /// Invalid response format
29    #[error("Invalid response format: {0}")]
30    InvalidResponse(String),
31
32    /// Timeout
33    #[error("Request timed out")]
34    Timeout,
35
36    /// Model not found
37    #[error("Model not found: {0}")]
38    ModelNotFound(String),
39
40    /// Configuration error
41    #[error("Configuration error: {0}")]
42    ConfigError(String),
43}