From 72ddd7b7704f2087a52c9c0552446682918c513b Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Thu, 22 Jan 2026 23:14:08 +0100 Subject: 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 --- src/errors.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/errors.rs (limited to 'src/errors.rs') 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 @@ +use std::{fmt, io}; + +#[allow(dead_code)] +#[derive(Debug)] +pub enum McError { + Io(io::Error), + Http(reqwest::Error), + Json(serde_json::Error), + Zip(zip::result::ZipError), + Config(String), + ShaMismatch(String), + Process(String), + Runtime(String), // ← NEW +} + +impl fmt::Display for McError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } +} + +impl From for McError { + fn from(e: io::Error) -> Self { Self::Io(e) } +} + +impl From for McError { + fn from(e: reqwest::Error) -> Self { Self::Http(e) } +} + +impl From for McError { + fn from(e: serde_json::Error) -> Self { Self::Json(e) } +} + +impl From for McError { + fn from(e: zip::result::ZipError) -> Self { Self::Zip(e) } +} -- cgit v1.2.3