1use thiserror::Error;
2
3use crate::{Query, QueryKey};
4
5#[derive(Error, Debug)]
6pub enum MdnsError {
7 #[error("io error: {}", .0)]
8 IOError(#[from] std::io::Error),
9
10 #[error("dns error: {}", .0)]
11 DNSError(#[from] simple_dns::SimpleDnsError),
12
13 #[error("error sending query: {}", .0)]
14 QuerySendError(#[from] tokio::sync::mpsc::error::SendError<Query>),
15
16 #[error("oneshot error: {}", .0)]
17 OneshotError(#[from] tokio::sync::oneshot::error::RecvError),
18
19 #[error("query timed out: {:?}", .0)]
20 TimedOut(QueryKey)
21}
22
23pub type Result<T> = std::result::Result<T, MdnsError>;