From 7d6973b5a2567c09c29acf50e220587260e89336 Mon Sep 17 00:00:00 2001 From: Qweder93 Date: Tue, 14 Jul 2020 16:31:02 +0300 Subject: [PATCH] satellite: heldamount and nodestats not returning error node not found by rpc Change-Id: Ifb00b16a4a04603251de60da6a6612fd5e98d597 --- satellite/heldamount/endpoint.go | 8 ++++---- satellite/nodestats/endpoint.go | 4 ++-- storagenode/heldamount/endpoint.go | 9 --------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/satellite/heldamount/endpoint.go b/satellite/heldamount/endpoint.go index 6f62d12df..fba9a638d 100644 --- a/satellite/heldamount/endpoint.go +++ b/satellite/heldamount/endpoint.go @@ -52,7 +52,7 @@ func (e *Endpoint) GetPayStub(ctx context.Context, req *pb.GetHeldAmountRequest) node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.NotFound, err.Error()) + return nil, nil } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) @@ -107,7 +107,7 @@ func (e *Endpoint) GetAllPaystubs(ctx context.Context, req *pb.GetAllPaystubsReq node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.NotFound, err.Error()) + return nil, nil } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) @@ -174,7 +174,7 @@ func (e *Endpoint) GetPayment(ctx context.Context, req *pb.GetPaymentRequest) (_ node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.NotFound, err.Error()) + return nil, nil } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) @@ -215,7 +215,7 @@ func (e *Endpoint) GetAllPayments(ctx context.Context, req *pb.GetAllPaymentsReq node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.NotFound, err.Error()) + return nil, nil } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) diff --git a/satellite/nodestats/endpoint.go b/satellite/nodestats/endpoint.go index 5082f0c27..440867ae9 100644 --- a/satellite/nodestats/endpoint.go +++ b/satellite/nodestats/endpoint.go @@ -52,7 +52,7 @@ func (e *Endpoint) GetStats(ctx context.Context, req *pb.GetStatsRequest) (_ *pb node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.PermissionDenied, err.Error()) + return nil, nil } e.log.Error("overlay.Get failed", zap.Error(err)) return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) @@ -98,7 +98,7 @@ func (e *Endpoint) DailyStorageUsage(ctx context.Context, req *pb.DailyStorageUs node, err := e.overlay.Get(ctx, peer.ID) if err != nil { if overlay.ErrNodeNotFound.Has(err) { - return nil, rpcstatus.Error(rpcstatus.PermissionDenied, err.Error()) + return nil, nil } e.log.Error("overlay.Get failed", zap.Error(err)) return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) diff --git a/storagenode/heldamount/endpoint.go b/storagenode/heldamount/endpoint.go index 979a2570b..c7bf121f6 100644 --- a/storagenode/heldamount/endpoint.go +++ b/storagenode/heldamount/endpoint.go @@ -5,7 +5,6 @@ package heldamount import ( "context" - "strings" "github.com/zeebo/errs" "go.uber.org/zap" @@ -111,10 +110,6 @@ func (endpoint *Endpoint) GetAllPaystubs(ctx context.Context, satelliteID storj. resp, err := client.GetAllPaystubs(ctx, &pb.GetAllPaystubsRequest{}) if err != nil { - if strings.Contains(err.Error(), "node not found") { - return nil, nil - } - return nil, ErrHeldAmountService.Wrap(err) } @@ -198,10 +193,6 @@ func (endpoint *Endpoint) GetAllPayments(ctx context.Context, satelliteID storj. resp, err := client.GetAllPayments(ctx, &pb.GetAllPaymentsRequest{}) if err != nil { - if strings.Contains(err.Error(), "node not found") { - return nil, nil - } - return nil, ErrHeldAmountService.Wrap(err) }