use std::{fmt, io};
#[derive(Debug)]
pub enum Error {
OpenSSL(openssl::error::ErrorStack),
IO(io::Error)
}
impl std::error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::IO(e) => write!(f, "I/O error; {e}"),
Self::OpenSSL(e) => write!(f, "OpenSSL error; {e}")
}
}
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Self::IO(err)
}
}
impl From<openssl::error::ErrorStack> for Error {
fn from(err: openssl::error::ErrorStack) -> Self {
Self::OpenSSL(err)
}
}