From 5eae2aac7850205f7818b0c0f257135b7f6439c0 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Sat, 22 Aug 2020 05:39:12 +0300 Subject: [PATCH] Change NotFound error for objectFindID method should return gRPC status error Signed-off-by: Evgeniy Kulikov --- api/layer/object.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/layer/object.go b/api/layer/object.go index c92edaff..a8906fac 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -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 }