use mdns_proto::{Name, error::RegisterServiceError as ProtoRegisterError};
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ServerError {
#[error("ServerOptions has neither IPv4 nor IPv6 enabled")]
NoFamilyEnabled,
#[error("bind v4: {0}")]
BindV4(hick_udp::BindError),
#[error("bind v6: {0}")]
BindV6(hick_udp::BindError),
#[error("wrap socket: {0}")]
WrapSocket(std::io::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum RegisterError {
#[error("name already registered: {0}")]
NameAlreadyRegistered(Name),
#[error("service pool is full")]
StorageFull,
#[error("endpoint driver is gone")]
DriverGone,
}
impl From<ProtoRegisterError> for RegisterError {
fn from(e: ProtoRegisterError) -> Self {
match e {
ProtoRegisterError::NameAlreadyRegistered(n) => Self::NameAlreadyRegistered(n),
ProtoRegisterError::StorageFull(_) => Self::StorageFull,
_ => Self::StorageFull,
}
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum StartQueryError {
#[error("query pool is full")]
StorageFull,
#[error("endpoint driver is gone")]
DriverGone,
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum CancelError {
#[error("endpoint driver is gone")]
DriverGone,
}