ricecoder_modes/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in the modes system
4#[derive(Debug, Error)]
5pub enum ModeError {
6    /// Mode not found with the given ID
7    #[error("Mode not found: {0}")]
8    NotFound(String),
9
10    /// Invalid mode transition attempted
11    #[error("Invalid mode transition: {0} -> {1}")]
12    InvalidTransition(String, String),
13
14    /// Capability not available in the specified mode
15    #[error("Capability not available in {mode}: {capability}")]
16    CapabilityNotAvailable {
17        /// The mode name
18        mode: String,
19        /// The capability name
20        capability: String,
21    },
22
23    /// Operation not allowed in the specified mode
24    #[error("Operation not allowed in {mode}: {operation}")]
25    OperationNotAllowed {
26        /// The mode name
27        mode: String,
28        /// The operation name
29        operation: String,
30    },
31
32    /// File operation blocked in Ask Mode
33    #[error("File operation blocked in Ask Mode")]
34    FileOperationBlocked,
35
36    /// Processing failed with the given reason
37    #[error("Processing failed: {0}")]
38    ProcessingFailed(String),
39
40    /// Think More processing timed out
41    #[error("Think More timeout after {0}ms")]
42    ThinkMoreTimeout(u64),
43
44    /// Configuration error
45    #[error("Configuration error: {0}")]
46    ConfigError(String),
47
48    /// Session context error
49    #[error("Session context error: {0}")]
50    ContextError(String),
51
52    /// Serialization error
53    #[error("Serialization error: {0}")]
54    SerializationError(#[from] serde_json::Error),
55}
56
57/// Result type for mode operations
58pub type Result<T> = std::result::Result<T, ModeError>;