Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectStorage: add AuthenticationError type #80

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}") }
}
}
Expand Down
8 changes: 8 additions & 0 deletions server/src/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,14 @@ impl From<SdkError<HeadBucketError>> 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)),
Expand Down
2 changes: 2 additions & 0 deletions server/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ pub enum ObjectStorageError {
DataFusionError(#[from] datafusion::error::DataFusionError),
#[error("Unhandled Error: {0}")]
UnhandledError(Box<dyn std::error::Error + Send + 'static>),
#[error("Authentication Error: {0}")]
AuthenticationError(Box<dyn std::error::Error + Send + 'static>),
}

impl From<ObjectStorageError> for crate::error::Error {
Expand Down