Skip to content

Commit

Permalink
[Bugfix] Register wasm query failed error to sdkerrors (#436)
Browse files Browse the repository at this point in the history
* register wasm query failed error code
* fix description for querier
  • Loading branch information
yys authored Jan 26, 2021
1 parent 381d5ac commit 9885acf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x/market/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func GetCmdQuerySwap(queryRoute string, cdc *codec.Codec) *cobra.Command {
Long: strings.TrimSpace(`
Query a quote for how many coins can be received in a swap operation. Note; rates are dynamic and can quickly change.
$ terracli query query swap 5000000uluna usdr
$ terracli query swap 5000000uluna usdr
`),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := context.NewCLIContext().WithCodec(cdc)
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/internal/keeper/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ func (k Keeper) queryToContract(ctx sdk.Context, contractAddr sdk.AccAddress, qu

k.consumeGas(ctx, gasUsed, "Contract Query")
if err != nil {
return nil, err
err = sdkerrors.Wrap(types.ErrContractQueryFailed, err.Error())
}

return queryResult, nil
return queryResult, err
}

func (k Keeper) getContractDetails(ctx sdk.Context, contractAddress sdk.AccAddress) (codeInfo types.CodeInfo, contractStorePrefix prefix.Store, err error) {
Expand Down
1 change: 1 addition & 0 deletions x/wasm/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ var (
ErrMigrationFailed = sdkerrors.Register(ModuleName, 11, "migrate wasm contract failed")
ErrNotMigratable = sdkerrors.Register(ModuleName, 12, "the contract is not migratable ")
ErrStoreCodeFailed = sdkerrors.Register(ModuleName, 13, "store wasm contract failed")
ErrContractQueryFailed = sdkerrors.Register(ModuleName, 14, "contract query failed")
)

0 comments on commit 9885acf

Please sign in to comment.