use pnet::packet::ethernet::EtherType;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum HuginnNetError {
#[error("Parse error: {0}")]
Parse(String),
#[error("Unsupported protocol: {0}")]
UnsupportedProtocol(String),
#[error("Invalid TCP flags: {0}")]
InvalidTcpFlags(u8),
#[error("Invalid package: {0}")]
UnexpectedPackage(String),
#[error("Unsupported ethernet type: {0}")]
UnsupportedEthernetType(EtherType),
#[error("Unacceptable configuration: {0}")]
MissConfiguration(String),
#[error("Unknown error")]
Unknown,
}
#[cfg(feature = "db")]
impl From<huginn_net_db::error::DatabaseError> for HuginnNetError {
fn from(err: huginn_net_db::error::DatabaseError) -> Self {
HuginnNetError::MissConfiguration(format!("Database error: {err}"))
}
}