ricecoder_files/
error.rs

1//! Error types for file management operations
2
3use std::path::PathBuf;
4
5/// Errors that can occur during file operations
6#[derive(Debug, thiserror::Error)]
7pub enum FileError {
8    /// File not found at the specified path
9    #[error("File not found: {0}")]
10    NotFound(PathBuf),
11
12    /// Permission denied for the operation
13    #[error("Permission denied: {0}")]
14    PermissionDenied(PathBuf),
15
16    /// Conflict detected at path: file already exists
17    #[error("Conflict detected at {0}: file already exists")]
18    ConflictDetected(PathBuf),
19
20    /// Invalid content provided
21    #[error("Invalid content: {0}")]
22    InvalidContent(String),
23
24    /// Content verification failed
25    #[error("Content verification failed: {0}")]
26    VerificationFailed(String),
27
28    /// Backup operation failed
29    #[error("Backup failed: {0}")]
30    BackupFailed(String),
31
32    /// Backup integrity check failed: hash mismatch
33    #[error("Backup integrity check failed: hash mismatch")]
34    BackupCorrupted,
35
36    /// Transaction operation failed
37    #[error("Transaction failed: {0}")]
38    TransactionFailed(String),
39
40    /// Rollback operation failed
41    #[error("Rollback failed: {0}")]
42    RollbackFailed(String),
43
44    /// Git operation failed
45    #[error("Git operation failed: {0}")]
46    GitError(String),
47
48    /// Diff generation failed
49    #[error("Diff generation failed: {0}")]
50    DiffError(String),
51
52    /// IO error
53    #[error("IO error: {0}")]
54    IoError(#[from] std::io::Error),
55}