1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use thiserror::Error;
use tor_error::HasKind;
#[derive(Error, Clone, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("Not enough directory information to build circuits")]
NotEnoughInfo,
#[error("No directory information available")]
NoInfo,
#[error("Directory is expired, and we haven't got a new one yet")]
DirExpired,
#[error("Directory is published too far in the future: Your clock is probably wrong")]
DirNotYetValid,
}
impl HasKind for Error {
fn kind(&self) -> tor_error::ErrorKind {
use tor_error::ErrorKind as EK;
use Error as E;
match self {
E::DirExpired => EK::DirectoryExpired,
E::DirNotYetValid => EK::ClockSkew,
E::NotEnoughInfo | E::NoInfo => EK::BootstrapRequired,
}
}
}