ricecoder_permissions/
error.rs

1//! Error types for the permissions system
2
3use thiserror::Error;
4
5/// Result type for permissions operations
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur in the permissions system
9#[derive(Error, Debug)]
10pub enum Error {
11    #[error("Permission denied for tool: {tool}")]
12    PermissionDenied { tool: String },
13
14    #[error("Invalid permission level: {0}")]
15    InvalidPermissionLevel(String),
16
17    #[error("Invalid glob pattern: {0}")]
18    InvalidGlobPattern(String),
19
20    #[error("Pattern matching error: {0}")]
21    PatternMatchError(String),
22
23    #[error("Configuration error: {0}")]
24    ConfigError(String),
25
26    #[error("Serialization error: {0}")]
27    SerializationError(#[from] serde_json::Error),
28
29    #[error("IO error: {0}")]
30    IoError(#[from] std::io::Error),
31
32    #[error("Invalid audit log entry: {0}")]
33    InvalidAuditEntry(String),
34
35    #[error("Prompt error: {0}")]
36    PromptError(String),
37
38    #[error("Internal error: {0}")]
39    Internal(String),
40}