-
Notifications
You must be signed in to change notification settings - Fork 774
Closed
Description
From #491 (comment)
an API like this:
if err := validate(content); err != nil {
for _, warning := range Warnings(err) {
// do something with warnings
}
}We could define interfaces like this:
type Warnings {
Warnings() []error
}
type Errors {
Errors() []error
}Either of these could be asserted on the error returned from the validate function. We can define helpers for common cases. For example, the below would not take the error path when there are just warnings:
if err := validate(content); err != nil && IgnoreWarnings(err) {
// handle hard errors
}stevvooe and dnephin