From 1b5aa8f56318972ab11a4562572ed45fb3b70b7f Mon Sep 17 00:00:00 2001 From: Szewek Date: Fri, 29 Sep 2023 04:38:05 +0200 Subject: [PATCH] Add author and improve entry repack errors --- src/bin/mc-repack/main.rs | 6 +++--- src/errors.rs | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bin/mc-repack/main.rs b/src/bin/mc-repack/main.rs index 7f75ebe..cbcedfe 100644 --- a/src/bin/mc-repack/main.rs +++ b/src/bin/mc-repack/main.rs @@ -11,7 +11,7 @@ mod cli_args; fn main() -> io::Result<()> { let args = cli_args::Args::parse(); - println!("█▀▄▀█ █▀▀ ▄▄ █▀█ █▀▀ █▀█ ▄▀█ █▀▀ █▄▀\n█ ▀ █ █▄▄ █▀▄ ██▄ █▀▀ █▀█ █▄▄ █ █\n"); + println!("█▀▄▀█ █▀▀ ▄▄ █▀█ █▀▀ █▀█ ▄▀█ █▀▀ █▄▀\n█ ▀ █ █▄▄ █▀▄ ██▄ █▀▀ █▀█ █▄▄ █ █ by Szeweq\n"); process_task_from(args) } @@ -167,9 +167,9 @@ fn thread_progress_bar(pb: ProgressBar) -> (JoinHandle<()>, Sender, inner: Box } +impl EntryRepackError { + /// Returns the inner error. + pub fn inner_error(&self) -> &dyn Error { + &*self.inner + } +} impl Error for EntryRepackError { fn source(&self) -> Option<&(dyn Error + 'static)> { Some(&*self.inner) @@ -45,7 +51,7 @@ impl Error for EntryRepackError { } impl Display for EntryRepackError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.name) + write!(f, "{}: {}", self.name, self.inner) } } @@ -56,6 +62,6 @@ pub struct BlacklistedFile; impl Error for BlacklistedFile {} impl Display for BlacklistedFile { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "Blacklisted") + f.write_str("Blacklisted") } } \ No newline at end of file