1use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum ScanError {
8 #[error(
9 "failed to compile regex for detector {detector_id} pattern {index}: {source}. Fix: correct the detector regex or capture group configuration"
10 )]
11 RegexCompile {
12 detector_id: String,
13 index: usize,
14 source: regex::Error,
15 },
16 #[error(
17 "failed to compile scanner regex set: {0}. Fix: simplify the detector regex set or remove the invalid pattern"
18 )]
19 RegexSetCompile(#[from] regex::Error),
20 #[error(
21 "failed to build Aho-Corasick literal matcher: {0}. Fix: check for empty or invalid detector keywords"
22 )]
23 AhoCorasick(#[from] aho_corasick::BuildError),
24 #[error("GPU scanner failure: {0}")]
25 Gpu(String),
26 #[error("SIMD scanner failure: {0}")]
27 Simd(String),
28}
29
30pub type Result<T> = std::result::Result<T, ScanError>;