<commit_before>package credentials

import "errors"

var (
	ErrNoValidProvidersFoundInChain = errors.New(`no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors`)
)

type ChainProvider struct {
	Providers     []Provider
	curr          Provider
	VerboseErrors bool
}

func NewChainCredentials(providers []Provider) *Credentials {
	return NewCredentials(&ChainProvider{
		Providers: append([]Provider{}, providers...),
	})
}

func (c *ChainProvider) Retrieve() (Value, error) {
	var errs []error
	for _, p := range c.Providers {
		creds, err := p.Retrieve()
		if err == nil {
			c.curr = p
			return creds, nil
		}
		errs = append(errs, err)
	}
	c.curr = nil

	var err error
	err = ErrNoValidProvidersFoundInChain
	if c.VerboseErrors {
		err = errors.New("no valid providers in chain")
	}
	return Value{}, err
}

func (c *ChainProvider) IsExpired() bool {
	if c.curr != nil {
		return c.curr.IsExpired()
	}<commit_msg>fixed error msg<commit_after>package credentials

import "errors"

var (
	ErrNoValidProvidersFoundInChain = errors.New(`no valid providers in chain`)
)

type ChainProvider struct {
	Providers     []Provider
	curr          Provider
	VerboseErrors bool
}

func NewChainCredentials(providers []Provider) *Credentials {
	return NewCredentials(&ChainProvider{
		Providers: append([]Provider{}, providers...),
	})
}

func (c *ChainProvider) Retrieve() (Value, error) {
	var errs []error
	for _, p := range c.Providers {
		creds, err := p.Retrieve()
		if err == nil {
			c.curr = p
			return creds, nil
		}
		errs = append(errs, err)
	}
	c.curr = nil

	err := ErrNoValidProvidersFoundInChain
	return Value{}, err
}

func (c *ChainProvider) IsExpired() bool {
	if c.curr != nil {
		return c.curr.IsExpired()
	}
{'fraction_non_alphanumeric': 0.11738148984198646, 'fraction_numerical': 0.0, 'mean_word_length': 3.966386554621849, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6327470', 'n_tokens_mistral': 612, 'n_tokens_neox': 591, 'n_words': 165}