ggen_cli_validation/
error.rs

1//! Validation error types
2
3#[derive(Debug, thiserror::Error)]
4pub enum ValidationError {
5    #[error("File not found: {path}")]
6    FileNotFound { path: String },
7
8    #[error("Permission denied: {operation} on {path}")]
9    PermissionDenied { operation: String, path: String },
10
11    #[error("Path traversal attempt detected: {path}")]
12    PathTraversal { path: String },
13
14    #[error("Invalid path: {path} - {reason}")]
15    InvalidPath { path: String, reason: String },
16
17    #[error("Write operation failed: {path} - {reason}")]
18    WriteFailed { path: String, reason: String },
19
20    #[error("Read operation failed: {path} - {reason}")]
21    ReadFailed { path: String, reason: String },
22
23    #[error("Circular dependency detected in command chain")]
24    CircularDependency,
25
26    #[error("Invalid command structure: {reason}")]
27    InvalidCommandStructure { reason: String },
28
29    #[error("Sandbox violation: {reason}")]
30    SandboxViolation { reason: String },
31
32    #[error("IO error: {0}")]
33    Io(#[from] std::io::Error),
34}
35
36pub type Result<T> = std::result::Result<T, ValidationError>;