Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
parent
412f4e719e
commit
ced9572d86
@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Improvements
|
||||
|
||||
* [#21936](https://github.com/cosmos/cosmos-sdk/pull/21936) Print possible enum values in error message after an invalid input was provided.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [#21809](https://github.com/cosmos/cosmos-sdk/pull/21809) Correctly handle enhanced sub commands.
|
||||
|
||||
@ -58,7 +58,12 @@ func (e enumValue) String() string {
|
||||
func (e *enumValue) Set(s string) error {
|
||||
valDesc, ok := e.valMap[s]
|
||||
if !ok {
|
||||
return fmt.Errorf("%s is not a valid value for enum %s", s, e.enum.FullName())
|
||||
var validValues []string
|
||||
for k := range e.valMap {
|
||||
validValues = append(validValues, k)
|
||||
}
|
||||
|
||||
return fmt.Errorf("%s is not a valid value for enum %s. Valid values are: %s", s, e.enum.FullName(), strings.Join(validValues, ", "))
|
||||
}
|
||||
e.value = valDesc.Number()
|
||||
return nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user