Change NotFound error for objectFindID

method should return gRPC status error

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2020-08-22 05:39:12 +03:00
parent 5258342881
commit 5eae2aac78

View file

@ -13,6 +13,8 @@ import (
"github.com/nspcc-dev/neofs-s3-gate/api/pool"
"github.com/pkg/errors"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
const (
@ -226,7 +228,7 @@ func (n *layer) objectFindID(ctx context.Context, cid refs.CID, name string, put
return id, nil
}
}
return id, errors.New("object not found")
return id, status.Error(codes.NotFound, "object not found")
} else if ln == 1 {
return result[0], nil
}