Use structured errors during validation

Suggestion: Make these public fields, for easy access outside the package. I got this wrong in my original suggestion along these lines. :)