x/bank/keeper: fix a missing gRPC error in AllBalances (#8085)

* x/bank/keeper: fix a missing gRPC error in AllBalances

Fixes an incoherent return which had:
    (non-nil value, non-nil-non-grpc error)
to
    (nil value, non-nil-gRPC error)

and it is a follow-up of PR #7814.

* types/query: fix pagination test (#8096)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
Emmanuel T Odeke 2020-12-07 01:32:59 -08:00 committed by GitHub
parent c8a9da1d27
commit a8c3b4414d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -159,7 +159,7 @@ func (s *paginationTestSuite) TestPagination() {
request = types.NewQueryAllBalancesRequest(addr1, pageReq)
res, err = queryClient.AllBalances(gocontext.Background(), request)
s.Require().Error(err)
s.Require().Equal(err.Error(), "invalid request, either offset or key is expected, got both")
s.Require().Equal("rpc error: code = InvalidArgument desc = paginate: invalid request, either offset or key is expected, got both", err.Error())
s.T().Log("verify paginate with offset greater than total results")
pageReq = &query.PageRequest{Offset: 300, Limit: defaultLimit, CountTotal: false}

View File

@ -72,7 +72,7 @@ func (k BaseKeeper) AllBalances(ctx context.Context, req *types.QueryAllBalances
})
if err != nil {
return &types.QueryAllBalancesResponse{}, err
return nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err)
}
return &types.QueryAllBalancesResponse{Balances: balances, Pagination: pageRes}, nil