From 5d8a0bdd13585f6c2dc7fd37bbb8354ee81dd620 Mon Sep 17 00:00:00 2001 From: Thibault Mange <22740367+thibaultmg@users.noreply.github.com> Date: Thu, 4 May 2023 09:10:45 +0200 Subject: [PATCH] Update pkg/store/bucket.go Co-authored-by: Saswata Mukherjee Signed-off-by: Thibault Mange <22740367+thibaultmg@users.noreply.github.com> --- pkg/store/bucket.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 15084d4791..bba434727a 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1574,13 +1574,11 @@ func (s *BucketStore) LabelNames(ctx context.Context, req *storepb.LabelNamesReq s.mtx.RUnlock() if err := g.Wait(); err != nil { - if statusErr, ok := status.FromError(err); ok { - if statusErr.Code() == codes.ResourceExhausted { - return nil, status.Error(codes.ResourceExhausted, err.Error()) - } + code := codes.Internal + if s, ok := status.FromError(errors.Cause(err)); ok { + code = s.Code() } - - return nil, status.Error(codes.Internal, err.Error()) + return nil, status.Error(code, err.Error()) } anyHints, err := types.MarshalAny(resHints)