iflow_cli_sdk_rust/
error.rs1use thiserror::Error;
6
7#[derive(Error, Debug)]
11pub enum IFlowError {
12 #[error("Connection error: {0}")]
14 Connection(String),
15
16 #[error("Protocol error: {0}")]
18 Protocol(String),
19
20 #[error("Authentication error: {0}")]
22 Authentication(String),
23
24 #[error("Timeout error: {0}")]
26 Timeout(String),
27
28 #[error("Tool call error: {0}")]
30 ToolCall(String),
31
32 #[error("Validation error: {0}")]
34 Validation(String),
35
36 #[error("Transport error: {0}")]
38 Transport(String),
39
40 #[error("JSON parsing error: {0}")]
42 JsonParse(#[from] serde_json::Error),
43
44 #[error("WebSocket error: {0}")]
46 WebSocket(String),
47
48 #[error("IO error: {0}")]
50 Io(#[from] std::io::Error),
51
52 #[error("Process manager error: {0}")]
54 ProcessManager(String),
55
56 #[error("Not connected")]
58 NotConnected,
59
60 #[error("Session not found")]
62 SessionNotFound,
63
64 #[error("Invalid message format: {0}")]
66 InvalidMessage(String),
67
68 #[error("Unknown error: {0}")]
70 Unknown(String),
71}
72
73pub type Result<T> = std::result::Result<T, IFlowError>;