puppetlabs/puppetlabs-stdlib — pull request #47 by jeffmccune (2012-03-07 23:06:18+00:00)
Title: (#12357) Add ability to display an error message from validate_re

I've seen a number of times the following error displayed to the end
user:

validate_re(): "" does not match "^true$|^false$" at /p/t/f.pp:40

This is an absolutely horrific error message. I'm to blame for it.
Users stumble over this quite often and they shouldn't have to go read
the code to sort out what's happening.

This patch makes an effort to fix the problem by adding a third,
optional, argument to validate_re(). This third argument will be the
message thrown back in the exception which will be displayed to the end
user.

This sets the stage for nicer error messages coming from modules we
write.

This patch is backwards compatible but is a new feature.