satellite: heldamount and nodestats not returning error node not found by rpc

Change-Id: Ifb00b16a4a04603251de60da6a6612fd5e98d597
This commit is contained in:
Qweder93 2020-07-14 16:31:02 +03:00
parent 1149417615
commit 7d6973b5a2
3 changed files with 6 additions and 15 deletions

View File

@ -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())

View File

@ -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())

View File

@ -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)
}