1use thiserror::Error;
4
5#[cfg(feature = "mcp")]
6use rmcp::service::ServiceError;
7
8#[derive(Debug, Error)]
9pub enum Error {
10 #[error("HTTP client error: {source}")]
11 HttpClient {
12 #[from]
13 source: reqwest::Error,
14 },
15
16 #[error("API error (status {status}): {message}")]
17 ApiError { status: u16, message: String },
18
19 #[error("Invalid configuration: {message}")]
20 InvalidConfig { message: String },
21
22 #[error("Parse error: {message}")]
23 Parse { message: String },
24
25 #[error("Serialization error: {source}")]
26 Serialization {
27 #[from]
28 source: serde_json::Error,
29 },
30
31 #[error("IO error: {source}")]
32 Io {
33 #[from]
34 source: std::io::Error,
35 },
36
37 #[error("Timeout: {message}")]
38 Timeout { message: String },
39
40 #[error("Missing thought signature: {message}")]
41 MissingThoughtSignature { message: String },
42
43 #[error("Auth error: {message}")]
44 Auth { message: String },
45
46 #[error("Channel closed")]
47 ChannelClosed,
48
49 #[error("WebSocket error: {source}")]
50 WebSocket {
51 #[from]
52 source: tokio_tungstenite::tungstenite::Error,
53 },
54
55 #[cfg(feature = "mcp")]
56 #[error("MCP error: {source}")]
57 Mcp {
58 #[from]
59 source: ServiceError,
60 },
61}
62
63pub type Result<T> = std::result::Result<T, Error>;