use thiserror::Error;
pub type Result<T> = std::result::Result<T, DetectionError>;
#[derive(Error, Debug)]
pub enum DetectionError {
#[error("Pattern matching failed: {0}")]
PatternMatching(String),
#[error("Input sanitization failed: {0}")]
Sanitization(String),
#[error("Threat scheduling failed: {0}")]
Scheduling(String),
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
#[error("Input exceeds maximum length of {max} bytes (got {actual})")]
InputTooLarge { max: usize, actual: usize },
#[error("Invalid UTF-8 encoding: {0}")]
InvalidEncoding(String),
#[error("Temporal comparison error: {0}")]
TemporalCompare(String),
#[error("Detection error: {0}")]
Generic(String),
}
impl From<anyhow::Error> for DetectionError {
fn from(err: anyhow::Error) -> Self {
DetectionError::Generic(err.to_string())
}
}