File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ use datafusion::execution::context::SessionState;
28
28
29
29
use async_trait:: async_trait;
30
30
use aws_config:: BehaviorVersion ;
31
+ use aws_credential_types:: provider:: error:: CredentialsError ;
31
32
use aws_credential_types:: provider:: { ProvideCredentials , SharedCredentialsProvider } ;
32
33
use log:: debug;
33
34
use object_store:: aws:: { AmazonS3Builder , AwsCredential } ;
@@ -140,10 +141,19 @@ impl CredentialsFromConfig {
140
141
// we can call `provide_credentials` here.
141
142
let credentials = match credentials. provide_credentials ( ) . await {
142
143
Ok ( _) => Some ( credentials) ,
143
- Err ( e ) => {
144
- debug ! ( "Could not use AWS SDK to get credentials: {e} " ) ;
144
+ Err ( CredentialsError :: CredentialsNotLoaded ( _ ) ) => {
145
+ debug ! ( "Could not use AWS SDK to get credentials" ) ;
145
146
None
146
147
}
148
+ // other errors like `CredentialsError::InvalidConfiguration`
149
+ // should be returned to the user so they can be fixed
150
+ Err ( e) => {
151
+ return Err ( DataFusionError :: ObjectStore ( object_store:: Error :: Generic {
152
+ store : "S3" ,
153
+ source : format ! ( "Error getting credentials from provider: {e}" )
154
+ . into ( ) ,
155
+ } ) ) ;
156
+ }
147
157
} ;
148
158
Ok ( Self {
149
159
region,
You can’t perform that action at this time.
0 commit comments