feagi_agent/core/
error.rs1pub type Result<T> = std::result::Result<T, SdkError>;
8
9#[derive(Debug, thiserror::Error)]
11pub enum SdkError {
12 #[error("ZMQ error: {0}")]
14 Zmq(#[from] zeromq::ZmqError),
15
16 #[error("JSON error: {0}")]
18 Json(#[from] serde_json::Error),
19
20 #[error("Registration failed: {0}")]
22 RegistrationFailed(String),
23
24 #[error("Agent not registered - call connect() first")]
26 NotRegistered,
27
28 #[error("Connection timeout: {0}")]
30 Timeout(String),
31
32 #[error("Invalid configuration: {0}")]
34 InvalidConfig(String),
35
36 #[error("Agent already connected")]
38 AlreadyConnected,
39
40 #[error("Heartbeat failed: {0}")]
42 HeartbeatFailed(String),
43
44 #[error("Thread communication error: {0}")]
46 ThreadError(String),
47
48 #[error("SDK error: {0}")]
50 Other(String),
51}
52
53impl SdkError {
54 pub fn is_retryable(&self) -> bool {
56 matches!(
57 self,
58 SdkError::Zmq(_) | SdkError::Timeout(_) | SdkError::HeartbeatFailed(_)
59 )
60 }
61}