review list_objects

This commit is contained in:
weisd
2024-12-24 17:01:37 +08:00
parent bfd58e5749
commit 938df62167
4 changed files with 107 additions and 58 deletions
+11
View File
@@ -52,6 +52,9 @@ pub enum StorageError {
#[error("Object not found: {0}/{1}")]
ObjectNotFound(String, String),
#[error("volume not found: {0}")]
VolumeNotFound(String),
#[error("Version not found: {0}/{1}-{2}")]
VersionNotFound(String, String, String),
@@ -193,6 +196,14 @@ pub fn is_err_bucket_exists(err: &Error) -> bool {
}
}
pub fn is_err_bucket_not_found(err: &Error) -> bool {
if let Some(e) = err.downcast_ref::<StorageError>() {
matches!(e, StorageError::VolumeNotFound(_)) || matches!(e, StorageError::BucketNotFound(_))
} else {
false
}
}
pub fn is_err_object_not_found(err: &Error) -> bool {
if is_err_file_not_found(err) {
return true;