Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#12357) Add ability to display an error message from validate_re #47

Conversation

jeffmccune
Copy link
Contributor

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.

@jamtur01
Copy link
Contributor

jamtur01 commented Mar 7, 2012

Woot! +1000.

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.
kbarber added a commit that referenced this pull request Mar 7, 2012
…er_error_messages

(#12357) Add ability to display an error message from validate_re
@kbarber kbarber merged commit e0eadf2 into puppetlabs:2.3.x Mar 7, 2012
@jeffmccune
Copy link
Contributor Author

@kbarber OK, addressed your comments (in person). Should be ready for another go now.

@slippycheeze
Copy link
Contributor

The documentation in this commit is excellent. Thank you for keeping the information and examples we present to users awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants