Skip to content

Commit

Permalink
Print proper error when unknown code id
Browse files Browse the repository at this point in the history
  • Loading branch information
Lior Bondarevski committed Aug 21, 2022
1 parent 767f1f6 commit d9295aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/compute/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ func GetCodeHashByCodeId(cliCtx client.Context, codeID string) ([]byte, error) {
return nil, err
}

// When querying for an unknown code id the output is an empty result (without any error)
if len(res) == 0 {
return nil, fmt.Errorf("failed to query contract code hash, unknown code id (%s)", codeID)
}

var codeResp types.QueryCodeResponse

err = json.Unmarshal(res, &codeResp)
Expand Down

0 comments on commit d9295aa

Please sign in to comment.