Skip to main content

rs_agent/
error.rs

1use thiserror::Error;
2
3/// Error types for the agent framework
4#[derive(Error, Debug)]
5pub enum AgentError {
6    #[error("Model error: {0}")]
7    ModelError(String),
8
9    #[error("Memory error: {0}")]
10    MemoryError(String),
11
12    #[error("Tool error: {0}")]
13    ToolError(String),
14
15    #[error("Configuration error: {0}")]
16    ConfigError(String),
17
18    #[error("Serialization error: {0}")]
19    SerializationError(#[from] serde_json::Error),
20
21    #[error("IO error: {0}")]
22    IoError(#[from] std::io::Error),
23
24    #[error("UTCP error: {0}")]
25    UtcpError(String),
26
27    #[error("Agent not found: {0}")]
28    AgentNotFound(String),
29
30    #[error("Tool not found: {0}")]
31    ToolNotFound(String),
32
33    #[error("Invalid state: {0}")]
34    InvalidState(String),
35
36    #[error("Other error: {0}")]
37    Other(String),
38
39    #[error("TOON format error: {0}")]
40    ToonFormatError(String),
41}
42
43pub type Result<T> = std::result::Result<T, AgentError>;