Skip to content

Commit

Permalink
Merge pull request #1074 from scrtlabs/lior-init-code-id
Browse files Browse the repository at this point in the history
Print proper error when unknown code id
  • Loading branch information
liorbond authored Aug 21, 2022
2 parents 767f1f6 + d9295aa commit 7b06ca0
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 7b06ca0

Please sign in to comment.