1use mdns_proto::{Name, error::RegisterServiceError as ProtoRegisterError};
4
5#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum ServerError {
9 #[error("ServerOptions has neither IPv4 nor IPv6 enabled")]
11 NoFamilyEnabled,
12
13 #[error("bind v4: {0}")]
15 BindV4(hick_udp::BindError),
16
17 #[error("bind v6: {0}")]
19 BindV6(hick_udp::BindError),
20
21 #[error("wrap socket: {0}")]
23 WrapSocket(std::io::Error),
24
25 #[error(transparent)]
27 Io(#[from] std::io::Error),
28}
29
30#[derive(Debug, thiserror::Error)]
32#[non_exhaustive]
33pub enum RegisterError {
34 #[error("name already registered: {0}")]
36 NameAlreadyRegistered(Name),
37
38 #[error("service pool is full")]
40 StorageFull,
41
42 #[error("endpoint driver is gone")]
44 DriverGone,
45}
46
47impl From<ProtoRegisterError> for RegisterError {
48 fn from(e: ProtoRegisterError) -> Self {
49 match e {
50 ProtoRegisterError::NameAlreadyRegistered(n) => Self::NameAlreadyRegistered(n),
51 ProtoRegisterError::StorageFull(_) => Self::StorageFull,
52 _ => Self::StorageFull,
53 }
54 }
55}
56
57#[derive(Debug, thiserror::Error)]
59#[non_exhaustive]
60pub enum StartQueryError {
61 #[error("query pool is full")]
63 StorageFull,
64
65 #[error("endpoint driver is gone")]
67 DriverGone,
68}
69
70#[derive(Debug, thiserror::Error)]
72#[non_exhaustive]
73pub enum CancelError {
74 #[error("endpoint driver is gone")]
76 DriverGone,
77}