Skip to content

Commit e960ceb

Browse files
authored
ObjectStorage: add AuthenticationError type (#80)
Fixes #52
1 parent 6f3f961 commit e960ceb

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

server/src/option.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ impl Config {
8686
url = self.storage.endpoint_url(),
8787
cause = inner
8888
),
89+
Err(ObjectStorageError::AuthenticationError(inner)) => panic!(
90+
"Failed to authenticate. Please ensure credentials are valid\n Caused by: {cause}",
91+
cause = inner
92+
),
8993
Err(error) => { panic!("{error}") }
9094
}
9195
}

server/src/s3.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,14 @@ impl From<SdkError<HeadBucketError>> for ObjectStorageError {
494494
},
495495
..
496496
} => ObjectStorageError::NoSuchBucket(S3_CONFIG.bucket_name().to_string()),
497+
SdkError::ServiceError {
498+
err:
499+
HeadBucketError {
500+
kind: HeadBucketErrorKind::Unhandled(err),
501+
..
502+
},
503+
..
504+
} => ObjectStorageError::AuthenticationError(err),
497505
SdkError::DispatchFailure(err) => ObjectStorageError::ConnectionError(Box::new(err)),
498506
SdkError::TimeoutError(err) => ObjectStorageError::ConnectionError(err),
499507
err => ObjectStorageError::UnhandledError(Box::new(err)),

server/src/storage.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ pub enum ObjectStorageError {
216216
DataFusionError(#[from] datafusion::error::DataFusionError),
217217
#[error("Unhandled Error: {0}")]
218218
UnhandledError(Box<dyn std::error::Error + Send + 'static>),
219+
#[error("Authentication Error: {0}")]
220+
AuthenticationError(Box<dyn std::error::Error + Send + 'static>),
219221
}
220222

221223
impl From<ObjectStorageError> for crate::error::Error {

0 commit comments

Comments
 (0)