ricecoder_sessions/
error.rs

1//! Error types for session operations
2
3use std::io;
4use thiserror::Error;
5
6/// Result type for session operations
7pub type SessionResult<T> = Result<T, SessionError>;
8
9/// Errors that can occur during session operations
10#[derive(Debug, Error)]
11pub enum SessionError {
12    /// Session not found
13    #[error("Session not found: {0}")]
14    NotFound(String),
15
16    /// Session already exists
17    #[error("Session already exists: {0}")]
18    AlreadyExists(String),
19
20    /// Invalid session state or data
21    #[error("Invalid session: {0}")]
22    Invalid(String),
23
24    /// Session limit reached
25    #[error("Session limit reached: maximum {max} sessions allowed")]
26    LimitReached { max: usize },
27
28    /// Storage error
29    #[error("Storage error: {0}")]
30    StorageError(String),
31
32    /// IO error
33    #[error("IO error: {0}")]
34    IoError(#[from] io::Error),
35
36    /// JSON serialization/deserialization error
37    #[error("JSON error: {0}")]
38    JsonError(#[from] serde_json::Error),
39
40    /// Configuration error
41    #[error("Configuration error: {0}")]
42    ConfigError(String),
43
44    /// Share not found
45    #[error("Share not found: {0}")]
46    ShareNotFound(String),
47
48    /// Share expired
49    #[error("Share expired: {0}")]
50    ShareExpired(String),
51
52    /// Permission denied
53    #[error("Permission denied: {0}")]
54    PermissionDenied(String),
55
56    /// Background agent error
57    #[error("Background agent error: {0}")]
58    AgentError(String),
59}