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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
//! Errors relating to being a hidden service client
use std::sync::Arc;
use futures::task::SpawnError;
use thiserror::Error;
use tor_error::{Bug, ErrorKind, HasKind};
/// Error that occurred attempting to reach a hidden service
#[derive(Error, Clone, Debug)]
#[non_exhaustive]
pub enum ConnError {
/// Unable to spawn
#[error("Unable to spawn {spawning}")]
Spawn {
/// What we were trying to spawn
spawning: &'static str,
/// What happened when we tried to spawn it
#[source]
cause: Arc<SpawnError>,
},
/// Internal error
#[error("{0}")]
Bug(#[from] Bug),
}
impl HasKind for ConnError {
fn kind(&self) -> ErrorKind {
use ConnError as CE;
match self {
CE::Spawn { cause, .. } => cause.kind(),
CE::Bug(e) => e.kind(),
}
}
}
/// Error that occurred attempting to start up a hidden service client connector
#[derive(Error, Clone, Debug)]
#[non_exhaustive]
pub enum StartupError {
/// Internal error
#[error("{0}")]
Bug(#[from] Bug),
}
impl HasKind for StartupError {
fn kind(&self) -> ErrorKind {
use StartupError as SE;
match self {
SE::Bug(e) => e.kind(),
}
}
}
|