Skip to content

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

Merged
kbarber merged 1 commit intopuppetlabs:2.3.xfrom
jeffmccune:feature/2.3.x/validate_re_better_error_messages
Mar 7, 2012
Merged

(#12357) Add ability to display an error message from validate_re#47
kbarber merged 1 commit intopuppetlabs:2.3.xfrom
jeffmccune:feature/2.3.x/validate_re_better_error_messages

Conversation

@jeffmccune
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@slippycheeze
Copy link
Copy Markdown
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.

5 participants