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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Utf8Error {
#[error("{0}")]
String(#[from] std::string::FromUtf8Error),
#[error("{0}")]
Slice(#[from] std::str::Utf8Error),
}
#[derive(Debug, Error)]
pub enum Error {
#[error("authentication failure: {0}")]
Authentication(String),
#[cfg(feature = "bdrck")]
#[error("{0}")]
Bdrck(#[from] bdrck::error::Error),
#[cfg(feature = "bincode")]
#[error("{0}")]
Bincode(#[from] bincode::Error),
#[error("{0}")]
BorrowMut(#[from] std::cell::BorrowMutError),
#[error("{0}")]
HexDecode(#[from] data_encoding::DecodeError),
#[cfg(feature = "curl")]
#[error("{0}")]
Http(#[from] curl::Error),
#[error("internal error: {0}")]
Internal(String),
#[error("invalid argument: {0}")]
InvalidArgument(String),
#[error("{0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
Nul(#[from] std::ffi::NulError),
#[cfg(feature = "chrono")]
#[error("{0}")]
ParseDateTime(#[from] chrono::ParseError),
#[error("{0}")]
ParseBool(#[from] std::str::ParseBoolError),
#[error("{0}")]
ParseInt(#[from] std::num::ParseIntError),
#[cfg(feature = "piv")]
#[error("{0}")]
SmartCard(#[from] crate::piv::scarderr::SmartCardError),
#[error("{0}")]
Ssl(#[from] openssl::error::ErrorStack),
#[error("{0}")]
StringParse(#[from] std::string::ParseError),
#[error("{0}")]
ThreadLocalAccess(#[from] std::thread::AccessError),
#[error("unknown error: {0}")]
Unknown(String),
#[error("{0}")]
Utf8(Utf8Error),
}
impl<E> From<E> for Error
where
E: Into<Utf8Error>,
{
fn from(e: E) -> Self {
Error::Utf8(e.into())
}
}
pub type Result<T> = std::result::Result<T, Error>;