#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid filter configuration: {reason}. Fix: {fix}")]
InvalidConfiguration {
reason: String,
fix: &'static str,
},
#[error("read failed: {source}. Fix: verify the reader remains open and readable")]
ReadFailed {
#[source]
source: std::io::Error,
},
#[cfg(feature = "socket-bpf")]
#[error(transparent)]
EbpfCompile(#[from] ebpfkit::compiler::CompileError),
#[error("eBPF kernel operation failed: {source}. Fix: run as root on Linux with BPF enabled; use a valid open socket FD for SO_ATTACH_BPF")]
EbpfKernel {
#[source]
source: std::io::Error,
},
#[error("eBPF socket filter unavailable: {reason}. Fix: {fix}")]
EbpfUnavailable {
reason: &'static str,
fix: &'static str,
},
}
pub type Result<T> = std::result::Result<T, Error>;