diff --git a/server/src/storage.rs b/server/src/storage.rs index c966b0026..306c95e33 100644 --- a/server/src/storage.rs +++ b/server/src/storage.rs @@ -140,6 +140,10 @@ pub enum ObjectStorageError { #[error("{0} not found")] NoSuchKey(String), + // custom + #[error("{0}")] + Custom(String), + // Could not connect to object storage #[error("Connection Error: {0}")] ConnectionError(Box), diff --git a/server/src/storage/s3.rs b/server/src/storage/s3.rs index 79b38426d..55a9efb8d 100644 --- a/server/src/storage/s3.rs +++ b/server/src/storage/s3.rs @@ -256,6 +256,15 @@ impl S3 { .with_label_values(&["PUT", status]) .observe(time); + if let Err(object_store::Error::NotFound { source, .. }) = &resp { + let source_str = source.to_string(); + if source_str.contains("NoSuchBucket") { + return Err(ObjectStorageError::Custom( + format!("Bucket '{}' does not exist in S3.", self.bucket).to_string(), + )); + } + } + resp.map(|_| ()).map_err(|err| err.into()) } diff --git a/server/src/storage/store_metadata.rs b/server/src/storage/store_metadata.rs index b47aa3d95..2c80ba835 100644 --- a/server/src/storage/store_metadata.rs +++ b/server/src/storage/store_metadata.rs @@ -156,14 +156,14 @@ pub async fn resolve_parseable_metadata() -> Result