diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/error.rs b/src/error.rs index e6afeaa..a2b37a8 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -34,8 +34,12 @@ impl std::error::Error for MLError { | |||
34 | impl fmt::Display for MLError { | 34 | impl fmt::Display for MLError { |
35 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 35 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
36 | match self.etype { | 36 | match self.etype { |
37 | ErrorType::ArgumentError => write!(f, "User input not accepted: {}", self.message), | 37 | ErrorType::ArgumentError => { |
38 | ErrorType::ArgumentCountError => write!(f, "Too many/too few arguments"), | 38 | write!(f, "User input not accepted: {}", self.message) |
39 | } | ||
40 | ErrorType::ArgumentCountError => { | ||
41 | write!(f, "Too many/too few arguments") | ||
42 | } | ||
39 | ErrorType::ConfigError => write!(f, "CONFIG"), | 43 | ErrorType::ConfigError => write!(f, "CONFIG"), |
40 | ErrorType::DBError => write!(f, "Database: {}", self.message), | 44 | ErrorType::DBError => write!(f, "Database: {}", self.message), |
41 | ErrorType::ModError => write!(f, "Mod: {}", self.message), | 45 | ErrorType::ModError => write!(f, "Mod: {}", self.message), |
@@ -106,9 +110,11 @@ impl From<std::io::Error> for MLError { | |||
106 | 110 | ||
107 | impl From<serde_json::error::Error> for MLError { | 111 | impl From<serde_json::error::Error> for MLError { |
108 | fn from(value: serde_json::error::Error) -> Self { | 112 | fn from(value: serde_json::error::Error) -> Self { |
109 | Self { etype: ErrorType::LibJson, message: value.to_string() } | 113 | Self { |
114 | etype: ErrorType::LibJson, | ||
115 | message: value.to_string(), | ||
116 | } | ||
110 | } | 117 | } |
111 | |||
112 | } | 118 | } |
113 | 119 | ||
114 | impl MLError { | 120 | impl MLError { |