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:
parent
c8a9da1d27
commit
a8c3b4414d
@ -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}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user