Check the correct error object in a few places inside blobstorage client

Signed-off-by: John Ewart <john@johnewart.net>
This commit is contained in:
John Ewart 2022-12-08 11:18:05 -08:00
parent a4b27ae49b
commit ee9bd09620
1 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func CreateContainerStorageClient(log logger.Logger, meta map[string]string) (*c
// Try using shared key credentials first
if m.AccountKey != "" {
credential, newSharedKeyErr := azblob.NewSharedKeyCredential(m.AccountName, m.AccountKey)
if err != nil {
if newSharedKeyErr != nil {
return nil, nil, fmt.Errorf("invalid shared key credentials with error: %w", newSharedKeyErr)
}
client, clientErr = container.NewClientWithSharedKeyCredential(URL.String(), credential, &options)
@ -88,7 +88,7 @@ func CreateContainerStorageClient(log logger.Logger, meta map[string]string) (*c
} else {
// fallback to AAD
credential, tokenErr := settings.GetTokenCredential()
if err != nil {
if tokenErr != nil {
return nil, nil, fmt.Errorf("invalid token credentials with error: %w", tokenErr)
}
client, clientErr = container.NewClient(URL.String(), credential, &options)