aboutsummaryrefslogtreecommitdiff
path: root/bin/src/err.rs
blob: c9db4d5edf3fe0fe62793578eda28ac79fb37f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::{io, path::PathBuf};

use globset::ErrorKind;
use rnix::parser::ParseError;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ConfigErr {
    #[error("error parsing glob `{0:?}`: {1}")]
    InvalidGlob(Option<String>, ErrorKind),

    #[error("path error: {0}")]
    InvalidPath(#[from] io::Error),
}

#[derive(Error, Debug)]
pub enum LintErr {
    #[error("[{0}] syntax error: {1}")]
    Parse(PathBuf, ParseError),
}

#[derive(Error, Debug)]
pub enum FixErr {
    #[error("[{0}] syntax error: {1}")]
    Parse(PathBuf, ParseError),
}

#[derive(Error, Debug)]
pub enum StatixErr {
    #[error("linter error: {0}")]
    Lint(#[from] LintErr),
    #[error("fixer error: {0}")]
    Fix(#[from] FixErr),
    #[error("config error: {0}")]
    Config(#[from] ConfigErr),
}