summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-11 19:37:57 -0700
committerTim Smith <tsmith@chef.io>2018-10-31 14:24:09 -0700
commitcb5d5d578fe2524a68845b6aa19b09445a5cc357 (patch)
treea6e427c43bfc30d1810024dd47c4a048e64d0efe
parente1b064ae64a60f31d31e66d19d31625217567d51 (diff)
downloadchef-better_error_13.tar.gz
Update per lamonts commentbetter_error_13
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/mixin/params_validate.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb
index b7597d2dee..c5ca1f85b8 100644
--- a/lib/chef/mixin/params_validate.rb
+++ b/lib/chef/mixin/params_validate.rb
@@ -179,8 +179,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