summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLeonardo Rodrigues de Mello <l@lmello.eu.org>2013-09-06 10:53:47 -0300
committerLeonardo Rodrigues de Mello <l@lmello.eu.org>2013-09-16 10:03:20 -0300
commit30e994fb6eb91e25a77e60a849f795d60c11af4b (patch)
tree3ef170c125734efa71decc06ab54e34efee75e45 /lib
parent806430224ad0da860be3761ab83f1e574b64fc60 (diff)
downloadpuppet-stdlib-30e994fb6eb91e25a77e60a849f795d60c11af4b.tar.gz
puppet-stdlib-30e994fb6eb91e25a77e60a849f795d60c11af4b.tar.bz2
enhanced the error message of pick function.
When pick function fail return a better error message like the other stdlib functions, indicating that the error is on function pick. This would help people that see the error to identity it is related to a incorrect use of stdlib function pick, instead of having to grep all puppet libraries and manifests source for the old message. I had also changed the spec test. pick function change spec as suggested GH-179 Fix the spec test to use expect {}.to instead of lambda {}.should as explained by Adrienthebo. "Using expect { }.to is preferred over lambda { }.should. In addition it's best practice to do a string match against the error message to ensure that we're catching the right error, instead of any error of the right type." Also fixed a typo on the error message, it was missing one space. pick function stylish fix as suggested on GH179
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/pick.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/pick.rb b/lib/puppet/parser/functions/pick.rb
index cbc0300..e9e5d66 100644
--- a/lib/puppet/parser/functions/pick.rb
+++ b/lib/puppet/parser/functions/pick.rb
@@ -21,7 +21,7 @@ EOS
args.delete(:undefined)
args.delete("")
if args[0].to_s.empty? then
- fail "Must provide non empty value."
+ fail Puppet::ParseError, "pick(): must receive at last one non empty value"
else
return args[0]
end