pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("HTTP request failed: {0}")]
Http(#[from] reqwest::Error),
#[error("authentication failed: the BMC did not issue a session ID")]
AuthenticationFailed,
#[error("TLS configuration failed: {0}")]
Tls(String),
#[error("invalid server address {0:?}: expected e.g. \"https://192.168.1.1\"")]
InvalidUrl(String),
#[error("malformed XML response: {0}")]
Xml(#[from] roxmltree::Error),
#[error("unexpected response from the BMC: expected <IPMI>, got <{0}>")]
UnexpectedResponse(String),
#[error("<{element}> is missing the `{attribute}` attribute")]
MissingAttribute {
element: String,
attribute: &'static str,
},
#[error("invalid hexadecimal value {value:?}")]
InvalidHex {
value: String,
},
#[error("unsupported linearisation formula {0:#04x}")]
UnsupportedLinearisation(u8),
}