fast_yaml_cli/batch/
error.rs1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum DiscoveryError {
9 #[error("invalid glob pattern '{pattern}': {source}")]
11 InvalidPattern {
12 pattern: String,
14 #[source]
16 source: globset::Error,
17 },
18
19 #[error("invalid glob pattern '{pattern}': {source}")]
21 InvalidGlobPattern {
22 pattern: String,
24 #[source]
26 source: glob::PatternError,
27 },
28
29 #[error("failed to read '{path}': {source}")]
31 IoError {
32 path: PathBuf,
34 #[source]
36 source: std::io::Error,
37 },
38
39 #[error("permission denied: '{path}'")]
41 PermissionDenied {
42 path: PathBuf,
44 },
45
46 #[error("broken symbolic link: '{path}'")]
48 BrokenSymlink {
49 path: PathBuf,
51 },
52
53 #[error("path does not exist: '{path}'")]
55 PathNotFound {
56 path: PathBuf,
58 },
59
60 #[error("failed to read file list from stdin: {source}")]
62 StdinError {
63 #[source]
65 source: std::io::Error,
66 },
67
68 #[error("exceeded maximum of {max} paths")]
70 TooManyPaths {
71 max: usize,
73 },
74}
75
76#[derive(Debug, Error)]
78#[allow(clippy::enum_variant_names)]
79pub enum ProcessingError {
80 #[error("failed to read file: {0}")]
82 ReadError(#[source] std::io::Error),
83
84 #[error("file is not valid UTF-8: {0}")]
86 Utf8Error(#[source] std::str::Utf8Error),
87
88 #[error("failed to parse YAML: {0}")]
90 ParseError(String),
91
92 #[error("failed to format YAML: {0}")]
94 FormatError(String),
95
96 #[error("failed to write file: {0}")]
98 WriteError(#[source] std::io::Error),
99
100 #[error("failed to memory-map file: {0}")]
102 MmapError(#[source] std::io::Error),
103}