diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-11 19:37:57 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-11 19:37:57 -0700 |
commit | 6c4c1d6a5c9eda3dc40b38a17d366a3bcac52582 (patch) | |
tree | c78b118becdb64c7ecc6040a05acd7baaf55b7a3 /lib/chef/mixin/params_validate.rb | |
parent | ad72bd244a9a9ca73edc0fded0c26a76081d4710 (diff) | |
download | chef-6c4c1d6a5c9eda3dc40b38a17d366a3bcac52582.tar.gz |
Update per lamonts commentbetter_error2
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/mixin/params_validate.rb')
-rw-r--r-- | lib/chef/mixin/params_validate.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb index 8a5f27c8fa..841a5a8fe6 100644 --- a/lib/chef/mixin/params_validate.rb +++ b/lib/chef/mixin/params_validate.rb @@ -175,8 +175,8 @@ class Chef return true if value == tb end # Ruby will print :something as something, which confuses users so make sure to print them as symbols - corrected_type_array = to_be.collect { |x| x.kind_of?(Symbol) ? ":#{x}" : x } - raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{corrected_type_array.join(", ")}! You passed #{value.inspect}.") + # by inspecting the value instead of just printing it + raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.map { |v| v.inspect }.join(", ")}! You passed #{value.inspect}.") end end |