1use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("http transport: {0}")]
8 Http(#[from] reqwest::Error),
9
10 #[error("xml parse: {0}")]
11 Xml(#[from] quick_xml::Error),
12
13 #[error("base64 decode: {0}")]
14 Base64(#[from] base64::DecodeError),
15
16 #[error("io: {0}")]
17 Io(#[from] std::io::Error),
18
19 #[error("ntlm: {0}")]
20 Ntlm(#[from] ntlmssp::NtlmError),
21
22 #[error("credssp: {0}")]
23 CredSsp(String),
24
25 #[error("auth: {0}")]
26 Auth(String),
27
28 #[error("wsman fault: {code}: {reason}")]
29 WsmanFault { code: String, reason: String },
30
31 #[error("protocol: {0}")]
32 Protocol(&'static str),
33
34 #[error("not connected: call connect() first")]
35 NotConnected,
36
37 #[error("not authenticated: call auth_ntlm() (or auth_credssp/auth_kerberos) first")]
38 NotAuthenticated,
39
40 #[error("unsupported: {0}")]
41 Unsupported(&'static str),
42}
43
44impl From<credssp::Error> for Error {
45 fn from(e: credssp::Error) -> Self {
46 Error::CredSsp(e.to_string())
47 }
48}
49
50pub type Result<T> = std::result::Result<T, Error>;