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
use std::sync::Arc;
use thiserror::Error;
#[derive(Error, Debug, Clone)]
#[non_exhaustive]
pub enum Error {
#[error("parsing error: {0}")]
BytesErr(#[from] tor_bytes::Error),
#[error("io error: {0}")]
IoErr(#[source] Arc<std::io::Error>),
#[error("Internal programming error: {0}")]
InternalError(String),
#[error("channel protocol violation: {0}")]
ChanProto(String),
#[error("invalid stream target address")]
BadStreamAddress,
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Error {
Error::IoErr(Arc::new(e))
}
}