@@ -650,25 +650,22 @@ func (b *bucket) ErrorAs(err error, i any) bool {
650650}
651651
652652func (b * bucket ) ErrorCode (err error ) gcerrors.ErrorCode {
653- if bloberror .HasCode (err , bloberror .BlobNotFound ) {
654- return gcerrors .NotFound
655- }
656- if bloberror .HasCode (err , bloberror .AuthenticationFailed ) {
657- return gcerrors .PermissionDenied
658- }
659653 var rErr * azcore.ResponseError
660654 if errors .As (err , & rErr ) {
661- code := bloberror .Code (rErr .ErrorCode )
662- if code == bloberror .BlobNotFound || rErr .StatusCode == 404 {
663- return gcerrors .NotFound
664- }
665- if code == bloberror .AuthenticationFailed {
655+ switch bloberror .Code (rErr .ErrorCode ) {
656+ case bloberror .AuthenticationFailed :
666657 return gcerrors .PermissionDenied
667- }
668- if code == bloberror .BlobAlreadyExists {
658+ case bloberror .BlobAlreadyExists :
669659 return gcerrors .FailedPrecondition
660+ case bloberror .BlobNotFound :
661+ return gcerrors .NotFound
662+ }
663+
664+ if rErr .StatusCode == http .StatusNotFound {
665+ return gcerrors .NotFound
670666 }
671667 }
668+
672669 if strings .Contains (err .Error (), "no such host" ) {
673670 // This happens with an invalid storage account name; the host
674671 // is something like invalidstorageaccount.blob.core.windows.net.
0 commit comments