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

use error struct over map[string][]error #9

Open
bodokaiser opened this issue Jul 21, 2014 · 0 comments
Open

use error struct over map[string][]error #9

bodokaiser opened this issue Jul 21, 2014 · 0 comments

Comments

@bodokaiser
Copy link
Contributor

I see this is controversy but I give it a try:

type ValidationError struct {
    Errors map[string][]error
}

// Returns first error.
func (err ValidationError) Error() {
    for k, errs := range err.Errors {
        return k + " value had " + errs[0].Error()
    }
}
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

1 participant