From 65016caa8d565942086540edbee95b8af1e75c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 29 Mar 2021 18:34:28 +0200 Subject: tcp event connected contains result --- mumlib/src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mumlib/src') diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs index 8c66068..820d5f3 100644 --- a/mumlib/src/error.rs +++ b/mumlib/src/error.rs @@ -3,7 +3,7 @@ use std::fmt; pub type Result = std::result::Result; -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum Error { DisconnectedError, AlreadyConnectedError, @@ -26,7 +26,7 @@ impl fmt::Display for Error { } } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Serialize, Deserialize)] pub enum ChannelIdentifierError { Invalid, Ambiguous, -- cgit v1.2.1 From 5af72d30bb1b34cbde1c3ba5e73b7c694461ae51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 29 Mar 2021 21:38:12 +0200 Subject: report invalid server password --- mumlib/src/error.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mumlib/src') diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs index 820d5f3..0259c28 100644 --- a/mumlib/src/error.rs +++ b/mumlib/src/error.rs @@ -10,6 +10,7 @@ pub enum Error { ChannelIdentifierError(String, ChannelIdentifierError), InvalidServerAddrError(String, u16), InvalidUsernameError(String), + InvalidServerPassword, } impl fmt::Display for Error { @@ -22,6 +23,7 @@ impl fmt::Display for Error { write!(f, "Invalid server address: {}: {}", addr, port) } Error::InvalidUsernameError(username) => write!(f, "Invalid username: {}", username), + Error::InvalidServerPassword => write!(f, "Invalid server password") } } } -- cgit v1.2.1 From 6e71b1fee95e5f320bbc27e4148ff48e0d390073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 29 Mar 2021 21:41:38 +0200 Subject: remove error suffix on error variants --- mumlib/src/error.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mumlib/src') diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs index 0259c28..f6a02a7 100644 --- a/mumlib/src/error.rs +++ b/mumlib/src/error.rs @@ -5,24 +5,24 @@ pub type Result = std::result::Result; #[derive(Clone, Debug, Serialize, Deserialize)] pub enum Error { - DisconnectedError, - AlreadyConnectedError, + Disconnected, + AlreadyConnected, ChannelIdentifierError(String, ChannelIdentifierError), - InvalidServerAddrError(String, u16), - InvalidUsernameError(String), + InvalidServerAddr(String, u16), + InvalidUsername(String), InvalidServerPassword, } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Error::DisconnectedError => write!(f, "Not connected to a server"), - Error::AlreadyConnectedError => write!(f, "Already connected to a server"), + Error::Disconnected=> write!(f, "Not connected to a server"), + Error::AlreadyConnected=> write!(f, "Already connected to a server"), Error::ChannelIdentifierError(id, kind) => write!(f, "{}: {}", kind, id), - Error::InvalidServerAddrError(addr, port) => { + Error::InvalidServerAddr(addr, port) => { write!(f, "Invalid server address: {}: {}", addr, port) } - Error::InvalidUsernameError(username) => write!(f, "Invalid username: {}", username), + Error::InvalidUsername(username) => write!(f, "Invalid username: {}", username), Error::InvalidServerPassword => write!(f, "Invalid server password") } } -- cgit v1.2.1 From f81e8a403d6317803a23ba0d43c862e0cfea52ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 30 Mar 2021 10:16:15 +0200 Subject: mumlib: re-export error --- mumlib/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mumlib/src') diff --git a/mumlib/src/lib.rs b/mumlib/src/lib.rs index bccf073..36edc10 100644 --- a/mumlib/src/lib.rs +++ b/mumlib/src/lib.rs @@ -3,6 +3,8 @@ pub mod config; pub mod error; pub mod state; +pub use error::Error; + use colored::*; use log::*; -- cgit v1.2.1