From a393e0a2f2c3678a3ea869dc1417fa269f2b1040 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Sat, 24 Jan 2026 08:29:14 +0100 Subject: 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 --- src/errors.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/errors.rs') 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 @@ use std::{fmt, io}; +use fmt::{Display, Formatter, Result}; +use zip::result::ZipError; + +/// Represents all possible errors that can occur in the DML launcher. +/// +/// This enum centralizes error handling for the entire application, +/// wrapping various underlying error types from I/O, HTTP requests, +/// JSON parsing, ZIP extraction, configuration issues, and runtime errors. #[allow(dead_code)] #[derive(Debug)] pub enum McError { Io(io::Error), Http(reqwest::Error), Json(serde_json::Error), - Zip(zip::result::ZipError), + Zip(ZipError), Config(String), ShaMismatch(String), Process(String), - Runtime(String), // ← NEW + Runtime(String), } -impl fmt::Display for McError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } +impl Display for McError { + /// Formats the error for user-friendly display. + /// + /// Currently, it uses the `Debug` format for simplicity. + fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "{:?}", self) } } impl From for McError { @@ -29,6 +40,6 @@ 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) } +impl From for McError { + fn from(e: ZipError) -> Self { Self::Zip(e) } } -- cgit v1.2.3