From 468723fbc7d6db9b3b24db6e25ac978233774097 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 11 Jun 2025 13:35:51 -0400 Subject: [PATCH] Add more context to error message for datafusion-cli config failure --- datafusion-cli/src/object_storage.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/datafusion-cli/src/object_storage.rs b/datafusion-cli/src/object_storage.rs index f203f9a008d3..01ba28609642 100644 --- a/datafusion-cli/src/object_storage.rs +++ b/datafusion-cli/src/object_storage.rs @@ -16,6 +16,7 @@ // under the License. use std::any::Any; +use std::error::Error; use std::fmt::{Debug, Display}; use std::sync::Arc; @@ -148,10 +149,20 @@ impl CredentialsFromConfig { // other errors like `CredentialsError::InvalidConfiguration` // should be returned to the user so they can be fixed Err(e) => { + // Pass back underlying error to the user, including underlying source + let source_message = if let Some(source) = e.source() { + format!(": {source}") + } else { + String::new() + }; + + let message = format!( + "Error getting credentials from provider: {e}{source_message}", + ); + return Err(DataFusionError::ObjectStore(object_store::Error::Generic { store: "S3", - source: format!("Error getting credentials from provider: {e}") - .into(), + source: message.into(), })); } };