rust_filesearch/
errors.rs1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
6pub enum FsError {
7 #[error("IO error: {0}")]
8 Io(#[from] std::io::Error),
9
10 #[error("Failed to access path: {path}")]
11 PathAccess {
12 path: PathBuf,
13 #[source]
14 source: std::io::Error,
15 },
16
17 #[error("Invalid glob pattern: {pattern}")]
18 InvalidGlob {
19 pattern: String,
20 #[source]
21 source: globset::Error,
22 },
23
24 #[error("Invalid regex pattern: {pattern}")]
25 InvalidRegex {
26 pattern: String,
27 #[source]
28 source: regex::Error,
29 },
30
31 #[error("Failed to parse size: {input}")]
32 InvalidSize { input: String },
33
34 #[error("Failed to parse date: {input}")]
35 InvalidDate { input: String },
36
37 #[error("Invalid output format: {format}")]
38 InvalidFormat { format: String },
39
40 #[error("CSV error: {0}")]
41 Csv(#[from] csv::Error),
42
43 #[error("JSON serialization error: {0}")]
44 Json(#[from] serde_json::Error),
45
46 #[error("Watch error: {0}")]
47 Watch(String),
48
49 #[error("No entries found matching criteria")]
50 NoEntriesFound,
51
52 #[error("IO error: {context}")]
53 IoError {
54 context: String,
55 #[source]
56 source: std::io::Error,
57 },
58}
59
60pub type Result<T> = std::result::Result<T, FsError>;