net_relay/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3    #[error("no pool")]
4    NoPool,
5
6    #[error("not match path")]
7    NotMatchPath,
8
9    #[error("no relay fn")]
10    NoRelayFn,
11
12    #[error("no bind address")]
13    NoBindAddress,
14
15    #[error("other error: {0}")]
16    Other(Box<dyn std::error::Error + Sync + Send + 'static>),
17}
18
19impl Error {
20    pub fn from_other<E: std::error::Error + Sync + Send + 'static>(e: E) -> Self {
21        Error::Other(Box::new(e))
22    }
23}
24
25impl From<std::io::Error> for Error {
26    fn from(value: std::io::Error) -> Self {
27        Error::from_other(value)
28    }
29}