handle errors

This commit is contained in:
yggverse 2024-11-28 23:27:53 +02:00
parent 16ed3efef0
commit f4cb0c3bcc
2 changed files with 13 additions and 4 deletions

View file

@ -3,6 +3,7 @@ use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
SocketConnectionClosed,
SocketConnection(glib::Error),
TlsClientConnection(glib::Error),
}
@ -10,8 +11,11 @@ impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::SocketConnectionClosed => write!(f, "Socket connection closed"),
Self::SocketConnection(reason) => {
write!(f, "Socket connection error: {reason}")
}
Self::TlsClientConnection(reason) => {
write!(f, "Could not create TLS connection: {reason}")
write!(f, "TLS client connection error: {reason}")
}
}
}