use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("Bytecode validation failed: {message}. Fix: recompile the rule set and ensure the compiler only emits valid instructions.")]
BytecodeValidation {
message: String,
},
#[error("GPU pipeline failed: {message}. Fix: verify wgpu is available and the compiled buffers fit the target adapter limits.")]
Gpu {
message: String,
},
#[error("Serialization failed: {message}. Fix: verify the index file is not truncated or corrupted.")]
Serialization {
message: String,
},
#[error("Invalid rule: {rule} — {message}. Fix: check the rule definition and recompile.")]
InvalidRule {
rule: String,
message: String,
},
#[error("Pattern compilation failed: {message}")]
PatternCompilation {
message: String,
},
}
impl From<warpstate::Error> for Error {
fn from(e: warpstate::Error) -> Self {
Self::PatternCompilation {
message: e.to_string(),
}
}
}