diff --git a/types/query/pagination_test.go b/types/query/pagination_test.go index e24d7c489d..f0e1377a1e 100644 --- a/types/query/pagination_test.go +++ b/types/query/pagination_test.go @@ -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} diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index a71d0d72c0..bcf143b8aa 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -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