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