Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT committed Jan 12, 2022
1 parent 42fa731 commit 7a5d045
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sdk/storage/azblob/zc_storage_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type StorageError struct {
func handleError(err error) error {
var respErr *azcore.ResponseError
if errors.As(err, &respErr) {
return &InternalError{defunkifyStorageError(respErr)}
return &InternalError{responseErrorToStorageError(respErr)}
}

if err != nil {
Expand All @@ -72,8 +72,8 @@ func handleError(err error) error {
return nil
}

// defunkifyStorageError is a function that takes the "funky" ResponseError and reduces it to a storageError.
func defunkifyStorageError(responseError *azcore.ResponseError) error {
// converts an *azcore.ResponseError to a *StorageError, or if that fails, a *InternalError
func responseErrorToStorageError(responseError *azcore.ResponseError) error {
var storageError StorageError
body, err := runtime.Payload(responseError.RawResponse)
if err != nil {
Expand All @@ -85,8 +85,6 @@ func defunkifyStorageError(responseError *azcore.ResponseError) error {
}
}

// errors.Unwrap(responseError.Unwrap())

storageError.response = responseError.RawResponse

storageError.ErrorCode = StorageErrorCode(responseError.RawResponse.Header.Get("x-ms-error-code"))
Expand Down

0 comments on commit 7a5d045

Please sign in to comment.