mini_langchain/
error.rs

1use crate::llm::error::LLMError;
2use crate::tools::error::ToolError;
3use crate::agent::error::AgentError;
4use crate::config::ConfigError;
5
6
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    #[error("LLM error: {0}")]
10    LLM(#[from] LLMError),
11    
12    #[error("Tool error: {0}")]
13    Tool(#[from] ToolError),
14    
15    #[error("Agent error: {0}")]
16    Agent(#[from] AgentError),
17    
18    #[error("Config error: {0}")]
19    Config(#[from] ConfigError),
20    
21    #[error("HTTP error: {0}")]
22    Http(#[from] reqwest::Error),
23    
24    #[error("JSON error: {0}")]
25    Json(#[from] serde_json::Error),
26}
27
28pub type Result<T> = std::result::Result<T, Error>;