openlegends_client/connection/
error.rsuse std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
TcpStream(std::io::Error),
TlsConnector(native_tls::Error),
TlsConnection(native_tls::HandshakeError<std::net::TcpStream>),
Utf8(std::str::Utf8Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::TcpStream(e) => {
write!(f, "TCP error: `{e}`")
}
Self::TlsConnector(e) => {
write!(f, "TLS error: `{e}`")
}
Self::TlsConnection(e) => {
write!(f, "Connection error: `{e}`")
}
Self::Utf8(e) => {
write!(f, "UTF-8 error: `{e}`")
}
}
}
}