diff options
author | Tim Smith <tsmith@chef.io> | 2018-11-01 11:11:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 11:11:52 -0700 |
commit | b399ed35e3f01c80bcb642cbdd5c1ba8a0c17cce (patch) | |
tree | af57736569bcf73b948956c78e49195ae4870848 | |
parent | f49dc361cc3ee0098a97687fed3c21af210bbdd4 (diff) | |
parent | cb5d5d578fe2524a68845b6aa19b09445a5cc357 (diff) | |
download | chef-b399ed35e3f01c80bcb642cbdd5c1ba8a0c17cce.tar.gz |
Merge pull request #7836 from chef/better_error_13
Backport: Throw better error on invalid resources actions
-rw-r--r-- | lib/chef/mixin/params_validate.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb index c955dd3b12..c5ca1f85b8 100644 --- a/lib/chef/mixin/params_validate.rb +++ b/lib/chef/mixin/params_validate.rb @@ -178,7 +178,9 @@ class Chef to_be.each do |tb| return true if value == tb end - raise Exceptions::ValidationFailed, _validation_message(key, "Option #{key} must be equal to one of: #{to_be.join(", ")}! You passed #{value.inspect}.") + # Ruby will print :something as something, which confuses users so make sure to print them as symbols + # 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 |