Skip to main content

ubiquity_core/
error.rs

1//! Error types for Ubiquity
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum UbiquityError {
7    #[error("Consciousness level {0} below operational threshold")]
8    ConsciousnessTooLow(f64),
9    
10    #[error("Coherence loss detected: {0}")]
11    CoherenceLoss(f64),
12    
13    #[error("Agent {0} not found in mesh")]
14    AgentNotFound(String),
15    
16    #[error("Socket error: {0}")]
17    SocketError(#[from] std::io::Error),
18    
19    #[error("Serialization error: {0}")]
20    SerializationError(#[from] serde_json::Error),
21    
22    #[error("Task execution failed: {0}")]
23    TaskExecutionError(String),
24    
25    #[error("Mesh communication error: {0}")]
26    MeshError(String),
27    
28    #[error("Invalid configuration: {0}")]
29    ConfigError(String),
30    
31    #[error("Database error: {0}")]
32    DatabaseError(String),
33    
34    #[error("LLM error: {0}")]
35    LLMError(String),
36    
37    #[error("Rate limit exceeded: {0}")]
38    RateLimitError(String),
39    
40    #[error("Authentication failed: {0}")]
41    AuthenticationError(String),
42    
43    #[error("Command execution failed: {0}")]
44    CommandExecution(String),
45    
46    #[error("Command timeout: {0}")]
47    Timeout(String),
48    
49    #[error("Resource not found: {0}")]
50    NotFound(String),
51    
52    #[error("Internal error: {0}")]
53    Internal(String),
54    
55    #[error("Network error: {0}")]
56    Network(String),
57    
58    #[error("Serialization error: {0}")]
59    Serialization(String),
60    
61    #[error("Configuration error: {0}")]
62    Configuration(String),
63    
64    #[error("Resource exhausted: {0}")]
65    ResourceExhausted(String),
66    
67    #[error("Cloud execution error: {0}")]
68    CloudExecution(String),
69    
70    #[error(transparent)]
71    Other(#[from] anyhow::Error),
72}
73
74pub type Result<T> = std::result::Result<T, UbiquityError>;