1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum KowalskiError {
5 #[error("Tool execution error: {0}")]
6 ToolExecution(String),
7
8 #[error("Configuration error: {0}")]
9 Configuration(String),
10
11 #[error("Network error: {0}")]
12 Network(String),
13
14 #[error("Content processing error: {0}")]
15 ContentProcessing(String),
16
17 #[error("Invalid input: {0}")]
18 ToolInvalidInput(String),
19
20 #[error("Resource not found: {0}")]
21 NotFound(String),
22
23 #[error("Permission denied: {0}")]
24 PermissionDenied(String),
25
26 #[error("Agent error: {0}")]
27 Agent(String),
28
29 #[error("Task error: {0}")]
30 Task(String),
31
32 #[error("IO error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("JSON error: {0}")]
36 Json(#[from] serde_json::Error),
37
38 #[error("URL error: {0}")]
39 Url(#[from] url::ParseError),
40
41 #[error("Config error: {0}")]
42 Config(#[from] config::ConfigError),
43
44 #[error("Template agent error: {0}")]
45 TemplateAgent(String),
46
47 #[error("Web agent error: {0}")]
48 WebAgent(String),
49
50 #[error("Academic agent error: {0}")]
51 AcademicAgent(String),
52
53 #[error("Tool chain error: {0}")]
54 ToolChain(String),
55
56 #[error("Task handler error: {0}")]
57 TaskHandler(String),
58
59 #[error("Validation error: {0}")]
60 Validation(String),
61
62 #[error("Authentication error: {0}")]
63 Authentication(String),
64
65 #[error("Authorization error: {0}")]
66 Authorization(String),
67
68 #[error("Rate limit error: {0}")]
69 RateLimit(String),
70
71 #[error("Timeout error: {0}")]
72 Timeout(String),
73
74 #[error("Connection error: {0}")]
75 Connection(String),
76
77 #[error("Serialization error: {0}")]
78 Serialization(String),
79
80 #[error("Deserialization error: {0}")]
81 Deserialization(String),
82
83 #[error("Database error: {0}")]
84 Database(String),
85
86 #[error("Cache error: {0}")]
87 Cache(String),
88
89 #[error("File system error: {0}")]
90 FileSystem(String),
91
92 #[error("Memory error: {0}")]
93 Memory(String),
94
95 #[error("Resource error: {0}")]
96 Resource(String),
97
98 #[error("State error: {0}")]
99 State(String),
100
101 #[error("Initialization error: {0}")]
102 Initialization(String),
103
104 #[error("Shutdown error: {0}")]
105 Shutdown(String),
106
107 #[error("Recovery error: {0}")]
108 Recovery(String),
109
110 #[error("Cleanup error: {0}")]
111 Cleanup(String),
112
113 #[error("Server error: {0}")]
114 Server(String),
115
116 #[error("Request error: {0}")]
117 Request(#[from] reqwest::Error),
118
119 #[error("Conversation not found: {0}")]
120 ConversationNotFound(String),
121
122 #[error("Execution error: {0}")]
123 Execution(String),
124
125 #[error("Network error: {0}")]
126 ToolNetwork(String),
127
128 #[error("Config error: {0}")]
129 ToolConfig(String),
130}
131
132impl From<String> for KowalskiError {
133 fn from(err: String) -> Self {
134 KowalskiError::Agent(err)
135 }
136}
137
138impl From<&str> for KowalskiError {
139 fn from(err: &str) -> Self {
140 KowalskiError::Agent(err.to_string())
141 }
142}