From 32ef240557841137c48b83a32b653440718f58e8 Mon Sep 17 00:00:00 2001 From: 123vivekr <123vivekr@gmail.com> Date: Tue, 30 Aug 2022 15:23:10 +0530 Subject: [PATCH] ObjectStorage: add AuthenticationError type --- server/src/option.rs | 4 ++++ server/src/s3.rs | 8 ++++++++ server/src/storage.rs | 2 ++ 3 files changed, 14 insertions(+) diff --git a/server/src/option.rs b/server/src/option.rs index 0e7f328d4..b1adc65fc 100644 --- a/server/src/option.rs +++ b/server/src/option.rs @@ -86,6 +86,10 @@ impl Config { url = self.storage.endpoint_url(), cause = inner ), + Err(ObjectStorageError::AuthenticationError(inner)) => panic!( + "Failed to authenticate. Please ensure credentials are valid\n Caused by: {cause}", + cause = inner + ), Err(error) => { panic!("{error}") } } } diff --git a/server/src/s3.rs b/server/src/s3.rs index 004addb99..1a53b519e 100644 --- a/server/src/s3.rs +++ b/server/src/s3.rs @@ -494,6 +494,14 @@ impl From> for ObjectStorageError { }, .. } => ObjectStorageError::NoSuchBucket(S3_CONFIG.bucket_name().to_string()), + SdkError::ServiceError { + err: + HeadBucketError { + kind: HeadBucketErrorKind::Unhandled(err), + .. + }, + .. + } => ObjectStorageError::AuthenticationError(err), SdkError::DispatchFailure(err) => ObjectStorageError::ConnectionError(Box::new(err)), SdkError::TimeoutError(err) => ObjectStorageError::ConnectionError(err), err => ObjectStorageError::UnhandledError(Box::new(err)), diff --git a/server/src/storage.rs b/server/src/storage.rs index e74a88679..ba4ad7102 100644 --- a/server/src/storage.rs +++ b/server/src/storage.rs @@ -216,6 +216,8 @@ pub enum ObjectStorageError { DataFusionError(#[from] datafusion::error::DataFusionError), #[error("Unhandled Error: {0}")] UnhandledError(Box), + #[error("Authentication Error: {0}")] + AuthenticationError(Box), } impl From for crate::error::Error {