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