From 3f4bcaef523b7a912887725620f14e424be704c0 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Sat, 14 Dec 2024 11:05:19 -0800 Subject: [PATCH] add ZipError to handling --- src/core/src/errors.rs | 6 ++++++ src/core/src/storage/mod.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/src/errors.rs b/src/core/src/errors.rs index 30d269a135..e8ce3e68aa 100644 --- a/src/core/src/errors.rs +++ b/src/core/src/errors.rs @@ -90,6 +90,9 @@ pub enum SourmashError { #[cfg(feature = "branchwater")] #[error(transparent)] RocksDBError(#[from] rocksdb::Error), + + #[error(transparent)] + ZipError(#[from] piz::result::ZipError), } #[derive(Debug, Error)] @@ -140,6 +143,7 @@ pub enum SourmashErrorCode { NifflerError = 100_005, CsvError = 100_006, RocksDBError = 100_007, + ZipError = 100_008, } #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] @@ -179,6 +183,8 @@ impl SourmashErrorCode { #[cfg(not(target_arch = "wasm32"))] #[cfg(feature = "branchwater")] SourmashError::RocksDBError { .. } => SourmashErrorCode::RocksDBError, + + SourmashError::ZipError { .. } => SourmashErrorCode::ZipError, } } } diff --git a/src/core/src/storage/mod.rs b/src/core/src/storage/mod.rs index 977932c674..b026b80d47 100644 --- a/src/core/src/storage/mod.rs +++ b/src/core/src/storage/mod.rs @@ -418,7 +418,7 @@ impl ZipStorage { subdir: None, path: Some(location.as_ref().into()), } - .try_build().expect("cannot open file as zip file"); + .try_build()?; let subdir = find_subdirs(storage.borrow_archive())?; storage.with_mut(|fields| *fields.subdir = subdir);