Skip to content

Commit faacd19

Browse files
author
Devdutt Shenoi
committed
don't panic on failure to read
1 parent 3122c01 commit faacd19

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/storage/object_storage.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,12 @@ pub trait ObjectStorage: Debug + Send + Sync + 'static {
461461
) -> Result<Option<Manifest>, ObjectStorageError> {
462462
let path = manifest_path(path.as_str());
463463
match self.get_object(&path).await {
464-
Ok(bytes) => Ok(Some(
465-
serde_json::from_slice(&bytes).expect("manifest is valid json"),
466-
)),
467-
Err(err) => {
468-
if matches!(err, ObjectStorageError::NoSuchKey(_)) {
469-
Ok(None)
470-
} else {
471-
Err(err)
472-
}
464+
Ok(bytes) => {
465+
let manifest = serde_json::from_slice(&bytes)?;
466+
Ok(Some(manifest))
473467
}
468+
Err(ObjectStorageError::NoSuchKey(_)) => Ok(None),
469+
Err(err) => Err(err),
474470
}
475471
}
476472

0 commit comments

Comments
 (0)