basho / clique

CLI Framework for Erlang
Apache License 2.0
147 stars 49 forks source link

Handle cuttlefish map errors #18

Closed andrewjstone closed 9 years ago

andrewjstone commented 9 years ago

Seeing the following using this branch: https://github.com/basho/riak_core/tree/feature/riak-cli-handoff-enable

Andrews-MacBook-Pro:riak_ee ajs$ dev/dev1/bin/riak-admin set handoff.disable_outbound=true
Invalid Configuration: {error,[{error,"Error transforming datatype for: handoff.disable_outbound"},
                               {error,"\"true\" is not a valid enum value, acceptable values are [\"on\",\"off\"]."}]}

We should display this information in a much nicer way.

macintux commented 9 years ago

Cuttlefish's odd approach to error handling makes it tempting to fix that first.

For example, why this:

cuttlefish_generator:minimal_map/2 -> {error,
                                                                 transform_datatypes,
                                                                 {error,
                                                                  [{error,
                                                                    "Error transforming datatype for: handoff.disable_outbound"},
                                                                   {error,
                                                                    "\"blah\" is not a valid enum value, acceptable values are [\"on\",\"off\"]."}]}}

Versus:

{error, transform_datatypes, {bad, "blah"}, {good, ["on", "off"]}}
andrewjstone commented 9 years ago

Fixed by #26