From 76a459e02eb8fed6b0d5a1bb3ad9ba37258bce01 Mon Sep 17 00:00:00 2001 From: MisileLaboratory Date: Mon, 17 Apr 2023 13:33:01 +0000 Subject: [PATCH] feat: good error handling --- src/commands/list.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/list.rs b/src/commands/list.rs index 5ddbd71..fc29b00 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -94,7 +94,9 @@ pub fn list_archive_contents( sevenz_rust::decompress_file_with_extract_fn(archive_path, ".", |entry, _, _| { a.borrow_mut().push(Ok(FileInArchive{path: entry.name().into(), is_dir: entry.is_directory()})); Ok(true) - }).expect("failed to get 7z file list"); + }).map_err( + |e| crate::Error::SevenzipError(e) + )?; Box::new(a.into_inner().into_iter()) } Gzip | Bzip | Lz4 | Lzma | Snappy | Zstd => {