Skip to main content

dht_crawler/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum DHTError {
5    #[error("网络错误: {0}")]
6    Network(#[from] std::io::Error),
7
8    #[error("锁中毒: {0}")]
9    LockPoisoned(String),
10
11    #[error("初始化错误: {0}")]
12    Init(String),
13
14    #[error("内部错误: {0}")]
15    Internal(String),
16
17    #[error("{0}")]
18    Other(String),
19}
20
21pub type Result<T> = std::result::Result<T, DHTError>;