diff --git a/cmd/api-errors.go b/cmd/api-errors.go index c0879ef7c..068dee03e 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -1796,6 +1796,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { } switch err { + case errVolumeNotFound: + apiErr = ErrNoSuchBucket case errInvalidArgument: apiErr = ErrAdminInvalidArgument case errNoSuchUser: diff --git a/cmd/bucket-metadata.go b/cmd/bucket-metadata.go index f2142a0f3..41bb32436 100644 --- a/cmd/bucket-metadata.go +++ b/cmd/bucket-metadata.go @@ -123,6 +123,9 @@ func (b *BucketMetadata) Load(ctx context.Context, api ObjectLayer, name string) configFile := path.Join(bucketConfigPrefix, name, bucketMetadataFile) data, err := readConfig(ctx, api, configFile) if err != nil { + if err == errConfigNotFound { + err = errVolumeNotFound + } return err } if len(data) <= 4 { @@ -149,7 +152,7 @@ func (b *BucketMetadata) Load(ctx context.Context, api ObjectLayer, name string) func loadBucketMetadata(ctx context.Context, objectAPI ObjectLayer, bucket string) (BucketMetadata, error) { b := newBucketMetadata(bucket) err := b.Load(ctx, objectAPI, b.Name) - if err != nil && !errors.Is(err, errConfigNotFound) { + if err != nil { return b, err }