diff options
author | fxqnlr <[email protected]> | 2023-05-02 20:37:23 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-05-02 20:37:23 +0200 |
commit | 202ed4fcaa69e7de23e83fab0bae4ced6209eee4 (patch) | |
tree | 94c907a04f357f71f35e0d4a27b7e272dc00c476 /src/error.rs | |
parent | e8cac6786bc2e91382316ef1023a494c3e812013 (diff) | |
download | modlist-202ed4fcaa69e7de23e83fab0bae4ced6209eee4.tar modlist-202ed4fcaa69e7de23e83fab0bae4ced6209eee4.tar.gz modlist-202ed4fcaa69e7de23e83fab0bae4ced6209eee4.zip |
added config option for default mc version
changed version input system
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index bd6e3da..e6afeaa 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -20,6 +20,7 @@ pub enum ErrorType { | |||
20 | LibSql, | 20 | LibSql, |
21 | LibReq, | 21 | LibReq, |
22 | LibChrono, | 22 | LibChrono, |
23 | LibJson, | ||
23 | IoError, | 24 | IoError, |
24 | Other, | 25 | Other, |
25 | } | 26 | } |
@@ -42,6 +43,7 @@ impl fmt::Display for MLError { | |||
42 | ErrorType::LibSql => write!(f, "SQL: {}", self.message), | 43 | ErrorType::LibSql => write!(f, "SQL: {}", self.message), |
43 | ErrorType::LibReq => write!(f, "REQWEST"), | 44 | ErrorType::LibReq => write!(f, "REQWEST"), |
44 | ErrorType::LibChrono => write!(f, "Chrono error: {}", self.message), | 45 | ErrorType::LibChrono => write!(f, "Chrono error: {}", self.message), |
46 | ErrorType::LibJson => write!(f, "JSON: {}", self.message), | ||
45 | ErrorType::IoError => write!(f, "IO"), | 47 | ErrorType::IoError => write!(f, "IO"), |
46 | ErrorType::Other => write!(f, "OTHER"), | 48 | ErrorType::Other => write!(f, "OTHER"), |
47 | } | 49 | } |
@@ -102,6 +104,13 @@ impl From<std::io::Error> for MLError { | |||
102 | } | 104 | } |
103 | } | 105 | } |
104 | 106 | ||
107 | impl From<serde_json::error::Error> for MLError { | ||
108 | fn from(value: serde_json::error::Error) -> Self { | ||
109 | Self { etype: ErrorType::LibJson, message: value.to_string() } | ||
110 | } | ||
111 | |||
112 | } | ||
113 | |||
105 | impl MLError { | 114 | impl MLError { |
106 | pub fn new(etype: ErrorType, message: &str) -> Self { | 115 | pub fn new(etype: ErrorType, message: &str) -> Self { |
107 | Self { | 116 | Self { |