Open cv711 opened 6 years ago
Could you add a piece of code which will illustrate the usecase? Do you want the parser to return an error that will aggregate every issue that the passed string has?
I image the following low-level API:
func ParseAuthenticationResults(rawStr) (*AuthenticationResults, error) {
p := AuthresParser{rawStr}
if err := p.Parse(); err != nil {
// err is of internal type ValidationError, and contains all the separate parsing errors
}
return p.AuthenticationResults(), nil
}
By default, the first parsing error might be fatal, for the whole parsing process, as it's now, but the AuthresParser might have an option, which switches off such strict behaviour.
something like #6 maybe?
The library is quite strict with validating arguments and exits when things are not exactly as it expects them to be. What would you say if we always tried to parse as much as we can and maybe append the validation errors to a collection struct that a user can optionally pass in during initialisation?
Chris