/ crates / bot / src / error.rs
error.rs
 1  /// Error types for the bot framework
 2  use thiserror::Error;
 3  
 4  pub type Result<T> = std::result::Result<T, BotError>;
 5  
 6  #[derive(Error, Debug)]
 7  pub enum BotError {
 8      #[error("Identity generation failed: {0}")]
 9      IdentityError(String),
10  
11      #[error("Wallet operation failed: {0}")]
12      WalletError(String),
13  
14      #[error("Scheduler error: {0}")]
15      SchedulerError(String),
16  
17      #[error("State transition error: {0}")]
18      StateError(String),
19  
20      #[error("Communication error: {0}")]
21      CommunicationError(String),
22  
23      #[error("Behavior execution failed: {0}")]
24      BehaviorError(String),
25  
26      #[error("Network error: {0}")]
27      NetworkError(String),
28  
29      #[error("Serialization error: {0}")]
30      SerializationError(#[from] serde_json::Error),
31  
32      #[error("Cryptographic error: {0}")]
33      CryptoError(String),
34  
35      #[error("Configuration error: {0}")]
36      ConfigError(String),
37  
38      #[error("Timeout error: {0}")]
39      TimeoutError(String),
40  
41      #[error("Invalid state: {0}")]
42      InvalidState(String),
43  
44      #[error(transparent)]
45      Other(#[from] anyhow::Error),
46  }