diff options
| author | Filip Wandzio <contact@philw.dev> | 2026-01-22 23:14:08 +0100 |
|---|---|---|
| committer | Filip Wandzio <contact@philw.dev> | 2026-01-22 23:14:08 +0100 |
| commit | 72ddd7b7704f2087a52c9c0552446682918c513b (patch) | |
| tree | e5134f215ea82c1fc8eda17b34e426a7b1dfafc6 /src/errors.rs | |
| download | dml-72ddd7b7704f2087a52c9c0552446682918c513b.tar.gz dml-72ddd7b7704f2087a52c9c0552446682918c513b.zip | |
Implement basic game files download logic
Implement core clap arguments
Respect XDG_BASE_DIR
Currently library extraction is broken because it assumes every instace has it's own library folder. This should be refactored so instances share libraries
Signed-off-by: Filip Wandzio <contact@philw.dev>
Diffstat (limited to '')
| -rw-r--r-- | src/errors.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs new file mode 100644 index 0000000..c167733 --- /dev/null +++ b/src/errors.rs | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | use std::{fmt, io}; | ||
| 2 | |||
| 3 | #[allow(dead_code)] | ||
| 4 | #[derive(Debug)] | ||
| 5 | pub enum McError { | ||
| 6 | Io(io::Error), | ||
| 7 | Http(reqwest::Error), | ||
| 8 | Json(serde_json::Error), | ||
| 9 | Zip(zip::result::ZipError), | ||
| 10 | Config(String), | ||
| 11 | ShaMismatch(String), | ||
| 12 | Process(String), | ||
| 13 | Runtime(String), // ← NEW | ||
| 14 | } | ||
| 15 | |||
| 16 | impl fmt::Display for McError { | ||
| 17 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } | ||
| 18 | } | ||
| 19 | |||
| 20 | impl From<io::Error> for McError { | ||
| 21 | fn from(e: io::Error) -> Self { Self::Io(e) } | ||
| 22 | } | ||
| 23 | |||
| 24 | impl From<reqwest::Error> for McError { | ||
| 25 | fn from(e: reqwest::Error) -> Self { Self::Http(e) } | ||
| 26 | } | ||
| 27 | |||
| 28 | impl From<serde_json::Error> for McError { | ||
| 29 | fn from(e: serde_json::Error) -> Self { Self::Json(e) } | ||
| 30 | } | ||
| 31 | |||
| 32 | impl From<zip::result::ZipError> for McError { | ||
| 33 | fn from(e: zip::result::ZipError) -> Self { Self::Zip(e) } | ||
| 34 | } | ||
