use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum SecretraceError {
#[error("Failed to read file: {path}")]
FileRead {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("Failed to parse file: {path}")]
Parse {
path: PathBuf,
#[source]
source: syn::Error,
},
#[error("Invalid configuration: {message}")]
Config {
message: String,
#[source]
source: Option<Box<dyn std::error::Error + Send + Sync>>,
},
#[error("Invalid regex pattern: {pattern}")]
Regex {
pattern: String,
#[source]
source: regex::Error,
},
#[error("Invalid glob pattern: {pattern}")]
Glob {
pattern: String,
#[source]
source: glob::PatternError,
},
}
pub type Result<T> = std::result::Result<T, SecretraceError>;