Skip to content

Commit

Permalink
fix(intertx): return grpc error codes in query response (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleem1314 authored Nov 8, 2022
1 parent 76a51ed commit 9ccfbdf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion x/intertx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ require (
github.com/golang/protobuf v1.5.2
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/regen-network/gocuke v0.6.2
github.com/regen-network/regen-ledger/errors v0.0.0-00010101000000-000000000000
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.8.0
github.com/tendermint/tendermint v0.34.22
github.com/tendermint/tm-db v0.6.7
google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959
google.golang.org/grpc v1.50.0
google.golang.org/grpc v1.50.1
gotest.tools/v3 v3.1.0
)

Expand Down Expand Up @@ -125,3 +126,5 @@ require (
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/regen-network/regen-ledger/errors => ../../errors
4 changes: 2 additions & 2 deletions x/intertx/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
6 changes: 3 additions & 3 deletions x/intertx/keeper/query_interchain_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types"

regenerrors "github.com/regen-network/regen-ledger/errors"
types "github.com/regen-network/regen-ledger/x/intertx/types/v1"
)

Expand All @@ -16,12 +16,12 @@ func (k Keeper) InterchainAccount(goCtx context.Context, req *types.QueryInterch

portID, err := icatypes.NewControllerPortID(req.Owner)
if err != nil {
return nil, err
return nil, regenerrors.ErrInvalidArgument.Wrap(err.Error())
}

addr, found := k.icaControllerKeeper.GetInterchainAccountAddress(ctx, req.ConnectionId, portID)
if !found {
return nil, sdkerrors.ErrNotFound.Wrapf("no account found for portID %s", portID)
return nil, regenerrors.ErrNotFound.Wrapf("no account found for portID %s", portID)
}

return &types.QueryInterchainAccountResponse{InterchainAccountAddress: addr}, nil
Expand Down

0 comments on commit 9ccfbdf

Please sign in to comment.