use std::{io, path::PathBuf};
use thiserror::Error;
use crate::lexer;
#[derive(Debug, Error)]
pub enum Error {
#[error("Invalid pattern: {pattern}")]
InvalidPattern {
pattern: String,
source: Option<lexer::Error>,
},
#[error("Pattern ({pattern}) did not compile to a valid regular expression: {source}")]
InvalidRegex {
pattern: String,
regex: String,
source: regex::Error,
},
#[error("Unable to read and store file, as the underlying file cache is poisoned: {0}")]
CachePoisoned(PathBuf),
#[error("Unable to read {file}: {source}")]
FileError {
file: PathBuf,
source: io::Error,
},
}