Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get azblob.StorageError for block blob operations #16781

Closed
deiter opened this issue Jan 10, 2022 · 6 comments
Closed

Unable to get azblob.StorageError for block blob operations #16781

deiter opened this issue Jan 10, 2022 · 6 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)

Comments

@deiter
Copy link

deiter commented Jan 10, 2022

Unable to get azblob.StorageError for block blob operations

Steps to reproduce

  • Download the latest versions of github.com/Azure/azure-sdk-for-go
  • Run simple block blob client and try to get properties for non-existing block blob:
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
...
serviceClient, err := azblob.NewServiceClientWithSharedKey(primaryEndpoint, sharedKeyCredential, nil)
containerClient := serviceClient.NewContainerClient(containerName)
blobClient := containerClient.NewBlockBlobClient(blobName)
properties, err := blockBlob.GetProperties(ctx, nil)
log.Printf("error is %+v: %+v", reflect.TypeOf(err), err)
storageError := azblob.StorageError{}
log.Printf("error is azblob.StorageError: %+v", errors.As(err, &storageError))

Expected results

error is *azblob.StorageError: ....
error is azblob.StorageError: true

Actual results: azblob.InternalError

error is *azblob.InternalError: ===== RESPONSE ERROR (ErrorCode=BlobNotFound) =====
Description=, Details: (none)
error is azblob.StorageError: false

And I didn't find a way to get the original error code - azblob.StorageError / ErrorCode

Thank you!

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 10, 2022
@deiter
Copy link
Author

deiter commented Jan 10, 2022

Related issue: Azure/azure-storage-blob-go#58

@RickWinter RickWinter added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Jan 10, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 10, 2022
@amishra-dev
Copy link

@zezha-msft could you kindly have someone look into this

@zezha-msft
Copy link

@mohsha-msft I believe a relevant change just happened but it's not released yet, does it address this issue?

@kaancfidan
Copy link

@mohsha-msft I believe a relevant change just happened but it's not released yet, does it address this issue?

Could you provide a way how to access this StorageError? I'm having the same issue while using 0.4.1 which is released in May.

@tasherif-msft tasherif-msft self-assigned this Sep 6, 2022
@tasherif-msft
Copy link
Contributor

tasherif-msft commented Sep 6, 2022

Hi @deiter!
Azure Core introduced https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azcore/errors.go#L14 which can be cast using:

var responseErr *azcore.ResponseError
errors.As(err, &responseErr)

this will be available in the next release.

@jhendrixMSFT
Copy link
Member

The usage of *azcore.ResponseError has been released in azblob@v0.5.0.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

8 participants