hcl: Add Diagnostics.Errs()
This commit is contained in:
parent
36446359d2
commit
1b7f2717a3
@ -96,6 +96,17 @@ func (d Diagnostics) HasErrors() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (d Diagnostics) Errs() []error {
|
||||
var errs []error
|
||||
for _, diag := range d {
|
||||
if diag.Severity == DiagError {
|
||||
errs = append(errs, diag)
|
||||
}
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// A DiagnosticWriter emits diagnostics somehow.
|
||||
type DiagnosticWriter interface {
|
||||
WriteDiagnostic(*Diagnostic) error
|
||||
|
Loading…
Reference in New Issue
Block a user