Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdk/vm): improve MsgCall panic error message for wrong number of …
…args (#1610) If a realm function Call has too many arguments, VMKeeper Call panics with an uninformative index error message like "index out of range [1] with length 1" when it is [checking the arguments](https://github.com/gnolang/gno/blob/12b4b458e1b13d491a5797aa11b2002242f012bd/gno.land/pkg/sdk/vm/keeper.go#L244). One of our devs lost time trying to figure this out, as would other devs presumably. This PR adds explicit checks for number of arguments with informative panic messages like "not enough arguments in call to Echo" or "too many arguments in call to Echo" . (These are the same errors as the Go compiler.) (I couldn't find an existing issue for this. If you already have other plans to improve this error message, then you can close this PR.) <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Signed-off-by: Jeff Thompson <jeff@thefirst.org> Co-authored-by: Morgan <git@howl.moe>
- Loading branch information