use core::fmt::Display;
use alloc::string::String;
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum SocketError {
UnsupportedAddressFamily,
Errno(i32),
Other(String),
#[default]
Unknown,
}
impl Display for SocketError {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
write!(f, "{self:?}")
}
}
impl embedded_io::Error for SocketError {
fn kind(&self) -> embedded_io::ErrorKind {
match self {
SocketError::UnsupportedAddressFamily => embedded_io::ErrorKind::Unsupported,
_ => embedded_io::ErrorKind::Other,
}
}
}
pub type TlsError = embedded_tls::TlsError;