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

Add a feature to customize error messages #39

Open
johnnncodes opened this issue Dec 15, 2015 · 4 comments
Open

Add a feature to customize error messages #39

johnnncodes opened this issue Dec 15, 2015 · 4 comments

Comments

@johnnncodes
Copy link

Would be great if there's an easy way to customize error messages.

@tj
Copy link

tj commented Jun 7, 2016

Agreed, seeing "zero value" is fine for in-app cases I think, but for end-user programs such as a CLI it can be confusing

@0x4139
Copy link

0x4139 commented Mar 11, 2017

any news regarding this?

@fr3fou
Copy link

fr3fou commented Jan 8, 2021

Any news?

@Egremy
Copy link

Egremy commented Apr 29, 2022

You can try to do the following:

validator.ErrMin = validator.TextErr{Err: errors.New("my custom error string")}
err := validator.Valid(2, "min=10")

if err != nil {
	fmt.Println(err)
}

I think that is applicable for all other errors.

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

No branches or pull requests

5 participants