Skip to content

Commit

Permalink
refactor: derive From for TaskError
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Oct 31, 2023
1 parent 8f98e73 commit 209e197
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/tarball/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ impl<'a> DownloadTarballToStore<'a> {
integrity: package_integrity.to_string(),
error,
})?;
#[derive(Debug, From)]

Check warning on line 205 in crates/tarball/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/tarball/src/lib.rs#L205

Added line #L205 was not covered by tests
enum TaskError {
Checksum(ssri::Error),
Other(TarballError),
Expand Down Expand Up @@ -240,8 +241,7 @@ impl<'a> DownloadTarballToStore<'a> {
entry_path.components().skip(1).collect::<PathBuf>().into_os_string();
let (file_path, file_hash) =
pacquet_cafs::write_non_index_file(store_dir, &buffer, file_suffix)
.map_err(TarballError::WriteCafs)
.map_err(TaskError::Other)?;
.map_err(TarballError::WriteCafs)?;

let tarball_index_key = cleaned_entry_path
.to_str()
Expand Down Expand Up @@ -269,8 +269,7 @@ impl<'a> DownloadTarballToStore<'a> {
serde_json::to_string(&tarball_index).expect("convert a TarballIndex to JSON");

pacquet_cafs::write_tarball_index_file(store_dir, &package_integrity, &tarball_index)
.map_err(TarballError::WriteCafs)
.map_err(TaskError::Other)?;
.map_err(TarballError::WriteCafs)?;

Ok(cas_paths)
})
Expand Down

0 comments on commit 209e197

Please sign in to comment.