aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
diff options
context:
space:
mode:
authorFilip Wandzio <contact@philw.dev>2026-01-24 08:29:14 +0100
committerFilip Wandzio <contact@philw.dev>2026-01-24 08:29:14 +0100
commita393e0a2f2c3678a3ea869dc1417fa269f2b1040 (patch)
tree606df6a9284b5bd2dbf84fa5e3d363b8e6a01322 /src/errors.rs
parent72ddd7b7704f2087a52c9c0552446682918c513b (diff)
downloaddml-a393e0a2f2c3678a3ea869dc1417fa269f2b1040.tar.gz
dml-a393e0a2f2c3678a3ea869dc1417fa269f2b1040.zip
Resolve audio not loading bug
Ensure all assets are downloading for each version Temporarily disable minecraft versions older than 1.8 because of the asset/manifest loading issues Implement basic documentation of modules Implement basic async/multithreading for downloading assets
Diffstat (limited to '')
-rw-r--r--src/errors.rs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/errors.rs b/src/errors.rs
index c167733..b98ae2d 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -1,20 +1,31 @@
1use std::{fmt, io}; 1use std::{fmt, io};
2 2
3use fmt::{Display, Formatter, Result};
4use zip::result::ZipError;
5
6/// Represents all possible errors that can occur in the DML launcher.
7///
8/// This enum centralizes error handling for the entire application,
9/// wrapping various underlying error types from I/O, HTTP requests,
10/// JSON parsing, ZIP extraction, configuration issues, and runtime errors.
3#[allow(dead_code)] 11#[allow(dead_code)]
4#[derive(Debug)] 12#[derive(Debug)]
5pub enum McError { 13pub enum McError {
6 Io(io::Error), 14 Io(io::Error),
7 Http(reqwest::Error), 15 Http(reqwest::Error),
8 Json(serde_json::Error), 16 Json(serde_json::Error),
9 Zip(zip::result::ZipError), 17 Zip(ZipError),
10 Config(String), 18 Config(String),
11 ShaMismatch(String), 19 ShaMismatch(String),
12 Process(String), 20 Process(String),
13 Runtime(String), // ← NEW 21 Runtime(String),
14} 22}
15 23
16impl fmt::Display for McError { 24impl Display for McError {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } 25 /// Formats the error for user-friendly display.
26 ///
27 /// Currently, it uses the `Debug` format for simplicity.
28 fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "{:?}", self) }
18} 29}
19 30
20impl From<io::Error> for McError { 31impl From<io::Error> for McError {
@@ -29,6 +40,6 @@ impl From<serde_json::Error> for McError {
29 fn from(e: serde_json::Error) -> Self { Self::Json(e) } 40 fn from(e: serde_json::Error) -> Self { Self::Json(e) }
30} 41}
31 42
32impl From<zip::result::ZipError> for McError { 43impl From<ZipError> for McError {
33 fn from(e: zip::result::ZipError) -> Self { Self::Zip(e) } 44 fn from(e: ZipError) -> Self { Self::Zip(e) }
34} 45}