Skip to content

Commit

Permalink
use the right error
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Oct 29, 2024
1 parent 142250a commit 373b5a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/source/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub(crate) fn extract_tar(
.with_style(log_handler.default_bytes_style()),
);

let file = File::open(archive).map_err(|_| SourceError::FileNotFound(archive.to_path_buf()))?;
let file = File::open(archive)?;
let buf_reader = std::io::BufReader::with_capacity(1024 * 1024, file);
let wrapped = progress_bar.wrap_read(buf_reader);

Expand Down Expand Up @@ -164,11 +164,11 @@ pub(crate) fn extract_zip(
.with_style(log_handler.default_bytes_style()),
);

let file = File::open(archive).map_err(|_| SourceError::FileNotFound(archive.to_path_buf()))?;
let file = File::open(archive)?;
let buf_reader = std::io::BufReader::with_capacity(1024 * 1024, file);

let mut archive = zip::ZipArchive::new(progress_bar.wrap_read(buf_reader))
.map_err(|e| SourceError::InvalidZip(e.to_string()))?;
let wrapped = progress_bar.wrap_read(buf_reader);
let mut archive =
zip::ZipArchive::new(wrapped).map_err(|e| SourceError::InvalidZip(e.to_string()))?;

let tmp_extraction_dir = tempfile::Builder::new().tempdir_in(target_directory)?;
archive
Expand Down

0 comments on commit 373b5a7

Please sign in to comment.