ralph_workflow/checkpoint/file_state/
error.rs1#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
3pub enum ValidationError {
4 FileMissing { path: String },
6
7 FileUnexpectedlyExists { path: String },
9
10 FileContentChanged { path: String },
12
13 GitHeadChanged { expected: String, actual: String },
15
16 GitWorkingTreeChanged { changes: String },
18
19 GitStateInvalid { reason: String },
21}
22
23impl std::fmt::Display for ValidationError {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 Self::FileMissing { path } => write!(f, "File missing: {}", path),
27 Self::FileUnexpectedlyExists { path } => write!(f, "File unexpectedly exists: {}", path),
28 Self::FileContentChanged { path } => write!(f, "File content changed: {}", path),
29 Self::GitHeadChanged { expected, actual } => {
30 write!(f, "Git HEAD changed: expected {}, got {}", expected, actual)
31 }
32 Self::GitWorkingTreeChanged { changes } => {
33 write!(f, "Git working tree changed: {}", changes)
34 }
35 Self::GitStateInvalid { reason } => write!(f, "Git state invalid: {}", reason),
36 }
37 }
38}
39
40impl std::error::Error for ValidationError {}