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

Resolves #258 (Small improvements to the error handling for the config) #259

Merged
merged 2 commits into from Mar 12, 2020

Conversation

Zedjones
Copy link
Member

@Zedjones Zedjones commented Mar 8, 2020

I added a validator tag called "notempty" which simply checks if the string set is an empty string. This is handy for required values that are strings, since we normally don't want them to be empty. I double-checked that the validator library didn't have this functionality already, but it doesn't seem to.

So now, you get nicer messages when you have a port number that is too small or too large or when you have an empty string in a required place.

Ex.

$ go run cmd/teleirc.go
Field Settings.IRC.Port failed to validate: 65535 too large.
Field Settings.IRC.Channel was an empty string. Perhaps you had a # and need to surround the value with ""?

@Zedjones Zedjones changed the title Closes #258: Small improvements to the error handling for the config Resolves #258 (Small improvements to the error handling for the config) Mar 8, 2020
@Zedjones Zedjones added this to In progress in TeleIRC development via automation Mar 8, 2020
@Zedjones Zedjones added this to the v2.0.0 milestone Mar 8, 2020
@jwflory jwflory linked an issue Mar 8, 2020 that may be closed by this pull request
@jwflory jwflory requested a review from a team March 8, 2020 00:14
@jwflory jwflory added improvement Improves on something that already exists quality assurance CI tests, unit tests, integration tests, any kind of testing labels Mar 8, 2020
Copy link
Member

@jwflory jwflory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handy and should be a more definite way of avoiding the issue @Tjzabel ran into last week. Thanks for jumping on this @Zedjones! Merging. 🎬

@jwflory jwflory merged commit 5ee22b1 into RITlug:go-port Mar 12, 2020
TeleIRC development automation moved this from In progress to Done Mar 12, 2020
jwflory added a commit that referenced this pull request Mar 27, 2020
Co-authored-by: Justin W. Flory (he/him) <4721034+jwflory@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves on something that already exists quality assurance CI tests, unit tests, integration tests, any kind of testing
Projects
Development

Successfully merging this pull request may close these issues.

Add better error handling for config validation failures
2 participants