1
1
import { fromEnv } from "@aws-sdk/credential-provider-env" ;
2
2
import { fromContainerMetadata , fromInstanceMetadata } from "@aws-sdk/credential-provider-imds" ;
3
3
import { AssumeRoleWithWebIdentityParams , fromTokenFile } from "@aws-sdk/credential-provider-web-identity" ;
4
- import { ProviderError } from "@aws-sdk/property-provider" ;
4
+ import { CredentialsProviderError } from "@aws-sdk/property-provider" ;
5
5
import {
6
6
loadSharedConfigFiles ,
7
7
ParsedIniData ,
@@ -203,14 +203,14 @@ const resolveProfileData = async (
203
203
} = data ;
204
204
205
205
if ( ! options . roleAssumer ) {
206
- throw new ProviderError (
206
+ throw new CredentialsProviderError (
207
207
`Profile ${ profileName } requires a role to be assumed, but no` + ` role assumption callback was provided.` ,
208
208
false
209
209
) ;
210
210
}
211
211
212
212
if ( source_profile && source_profile in visitedProfiles ) {
213
- throw new ProviderError (
213
+ throw new CredentialsProviderError (
214
214
`Detected a cycle attempting to resolve credentials for profile` +
215
215
` ${ getMasterProfileName ( options ) } . Profiles visited: ` +
216
216
Object . keys ( visitedProfiles ) . join ( ", " ) ,
@@ -228,7 +228,7 @@ const resolveProfileData = async (
228
228
const params : AssumeRoleParams = { RoleArn, RoleSessionName, ExternalId } ;
229
229
if ( mfa_serial ) {
230
230
if ( ! options . mfaCodeProvider ) {
231
- throw new ProviderError (
231
+ throw new CredentialsProviderError (
232
232
`Profile ${ profileName } requires multi-factor authentication,` + ` but no MFA code callback was provided.` ,
233
233
false
234
234
) ;
@@ -257,7 +257,9 @@ const resolveProfileData = async (
257
257
// terminal resolution error if a profile has been specified by the user
258
258
// (whether via a parameter, an environment variable, or another profile's
259
259
// `source_profile` key).
260
- throw new ProviderError ( `Profile ${ profileName } could not be found or parsed in shared` + ` credentials file.` ) ;
260
+ throw new CredentialsProviderError (
261
+ `Profile ${ profileName } could not be found or parsed in shared` + ` credentials file.`
262
+ ) ;
261
263
} ;
262
264
263
265
/**
@@ -276,7 +278,7 @@ const resolveCredentialSource = (credentialSource: string, profileName: string):
276
278
if ( credentialSource in sourceProvidersMap ) {
277
279
return sourceProvidersMap [ credentialSource ] ( ) ;
278
280
} else {
279
- throw new ProviderError (
281
+ throw new CredentialsProviderError (
280
282
`Unsupported credential source in profile ${ profileName } . Got ${ credentialSource } , ` +
281
283
`expected EcsContainer or Ec2InstanceMetadata or Environment.`
282
284
) ;
0 commit comments