use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("http transport: {0}")]
Http(#[from] reqwest::Error),
#[error("xml parse: {0}")]
Xml(#[from] quick_xml::Error),
#[error("base64 decode: {0}")]
Base64(#[from] base64::DecodeError),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("ntlm: {0}")]
Ntlm(#[from] ntlmssp::NtlmError),
#[error("credssp: {0}")]
CredSsp(String),
#[error("auth: {0}")]
Auth(String),
#[error("wsman fault: {code}: {reason}")]
WsmanFault { code: String, reason: String },
#[error("protocol: {0}")]
Protocol(&'static str),
#[error("not connected: call connect() first")]
NotConnected,
#[error("not authenticated: call auth_ntlm() (or auth_credssp/auth_kerberos) first")]
NotAuthenticated,
#[error("unsupported: {0}")]
Unsupported(&'static str),
}
impl From<credssp::Error> for Error {
fn from(e: credssp::Error) -> Self {
Error::CredSsp(e.to_string())
}
}
pub type Result<T> = std::result::Result<T, Error>;