Skip to content

Commit

Permalink
tweak: improve error message
Browse files Browse the repository at this point in the history
in case the user is trying to decompress a file with no filestem, just
the extension, which is confusing
  • Loading branch information
marcospb19 committed Nov 18, 2024
1 parent 4bb759b commit 065124c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/utils/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ pub fn warning(contents: String) {
}

#[derive(Debug)]
enum Message {
enum LoggerCommand {
Print(PrintMessage),
Flush { finished_barrier: Arc<Barrier> },
FlushAndShutdown,
PrintMessage(PrintMessage),
}

/// Message object used for sending logs from worker threads to a logging thread via channels.
Expand Down Expand Up @@ -110,8 +110,8 @@ mod logger_thread {

use super::*;

type LogReceiver = mpsc::Receiver<Message>;
type LogSender = mpsc::Sender<Message>;
type LogReceiver = mpsc::Receiver<LoggerCommand>;
type LogSender = mpsc::Sender<LoggerCommand>;

static SENDER: OnceLock<LogSender> = OnceLock::new();

Expand All @@ -130,14 +130,14 @@ mod logger_thread {
#[track_caller]
pub(super) fn send_log_message(msg: PrintMessage) {
get_sender()
.send(Message::PrintMessage(msg))
.send(LoggerCommand::Print(msg))
.expect("Failed to send print message");
}

#[track_caller]
fn send_shutdown_message() {
get_sender()
.send(Message::FlushAndShutdown)
.send(LoggerCommand::FlushAndShutdown)
.expect("Failed to send shutdown message");
}

Expand All @@ -146,7 +146,7 @@ mod logger_thread {
let barrier = Arc::new(Barrier::new(2));

get_sender()
.send(Message::Flush {
.send(LoggerCommand::Flush {
finished_barrier: barrier.clone(),
})
.expect("Failed to send shutdown message");
Expand Down Expand Up @@ -208,7 +208,7 @@ mod logger_thread {
};

match msg {
Message::PrintMessage(msg) => {
LoggerCommand::Print(msg) => {
// Append message to buffer
if let Some(msg) = msg.to_processed_message() {
buffer.push(msg);
Expand All @@ -218,11 +218,11 @@ mod logger_thread {
flush_logs_to_stderr(&mut buffer);
}
}
Message::FlushAndShutdown => {
LoggerCommand::FlushAndShutdown => {
flush_logs_to_stderr(&mut buffer);
break;
}
Message::Flush { finished_barrier } => {
LoggerCommand::Flush { finished_barrier } => {
flush_logs_to_stderr(&mut buffer);
finished_barrier.wait();
break;
Expand Down

0 comments on commit 065124c

Please sign in to comment.