update enum names

This commit is contained in:
yggverse 2024-11-27 16:11:30 +02:00
parent 5737b89278
commit 017a63b4e5
2 changed files with 8 additions and 6 deletions

View file

@ -58,7 +58,7 @@ pub fn auth(
certificate: TlsCertificate,
) -> Result<TlsClientConnection, Error> {
if socket_connection.is_closed() {
return Err(Error::Closed);
return Err(Error::SocketConnectionClosed);
}
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
@ -77,6 +77,6 @@ pub fn auth(
Ok(tls_client_connection)
}
Err(reason) => Err(Error::Tls(reason)),
Err(reason) => Err(Error::TlsClientConnection(reason)),
}
}

View file

@ -2,15 +2,17 @@ use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
Closed,
Tls(glib::Error),
SocketConnectionClosed,
TlsClientConnection(glib::Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::Closed => write!(f, "Socket connection closed"),
Self::Tls(reason) => write!(f, "Could not create TLS connection: {reason}"),
Self::SocketConnectionClosed => write!(f, "Socket connection closed"),
Self::TlsClientConnection(reason) => {
write!(f, "Could not create TLS connection: {reason}")
}
}
}
}