diff options
Diffstat (limited to 'bin/src/err.rs')
-rw-r--r-- | bin/src/err.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/src/err.rs b/bin/src/err.rs new file mode 100644 index 0000000..b3a79c2 --- /dev/null +++ b/bin/src/err.rs | |||
@@ -0,0 +1,28 @@ | |||
1 | use std::{io, path::PathBuf}; | ||
2 | |||
3 | use globset::ErrorKind; | ||
4 | use rnix::parser::ParseError; | ||
5 | use thiserror::Error; | ||
6 | |||
7 | #[derive(Error, Debug)] | ||
8 | pub enum ConfigErr { | ||
9 | #[error("error parsing glob `{0:?}`: {1}")] | ||
10 | InvalidGlob(Option<String>, ErrorKind), | ||
11 | |||
12 | #[error("path error: {0}")] | ||
13 | InvalidPath(#[from] io::Error), | ||
14 | } | ||
15 | |||
16 | #[derive(Error, Debug)] | ||
17 | pub enum LintErr { | ||
18 | #[error("[{0}] syntax error: {1}")] | ||
19 | Parse(PathBuf, ParseError), | ||
20 | } | ||
21 | |||
22 | #[derive(Error, Debug)] | ||
23 | pub enum StatixErr { | ||
24 | #[error("linter error: {0}")] | ||
25 | Lint(#[from] LintErr), | ||
26 | #[error("config error: {0}")] | ||
27 | Config(#[from] ConfigErr), | ||
28 | } | ||