use common_macro::stack_trace_debug;
use snafu::{Location, Snafu};
#[derive(Snafu)]
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum Error {
#[snafu(display("Failed to resolve endpoint {:?}", broker_endpoint))]
ResolveEndpoint {
broker_endpoint: String,
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to find ipv4 endpoint: {:?}", broker_endpoint))]
EndpointIPV4NotFound {
broker_endpoint: String,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to read file, path: {}", path))]
ReadFile {
path: String,
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to add root cert"))]
AddCert {
#[snafu(source)]
error: rustls::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to read cert, path: {}", path))]
ReadCerts {
path: String,
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to read key, path: {}", path))]
ReadKey {
path: String,
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to parse key, path: {}", path))]
KeyNotFound {
path: String,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to set client auth cert"))]
SetClientAuthCert {
#[snafu(source)]
error: rustls::Error,
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to load ca certs from system"))]
LoadSystemCerts {
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},
}
pub type Result<T> = std::result::Result<T, Error>;