1use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum NetError {
7 #[error("Transport error: {0}")]
8 Transport(String),
9
10 #[error("Connection error: {0}")]
11 Connection(String),
12
13 #[error("Protocol error: {0}")]
14 Protocol(String),
15
16 #[error("Peer not found: {0}")]
17 PeerNotFound(String),
18
19 #[error("Dial error: {0}")]
20 Dial(String),
21
22 #[error("IO error: {0}")]
23 Io(#[from] std::io::Error),
24
25 #[error("{0}")]
26 Other(String),
27}
28
29pub type NetResult<T> = Result<T, NetError>;