mirror of
https://github.com/coredns/coredns.git
synced 2025-12-22 10:05:17 -05:00
Fix for misleading SOA parser warnings (#7774)
* Improve SOA error handling/reporting. Signed-off-by: Ross Golder <ross@golder.org> * Add tests for malformed SOA records Signed-off-by: Ross Golder <ross@golder.org> * Address review comments: assert exact parse errors in SOA tests and fix gofmt Signed-off-by: Ross Golder <ross@golder.org> --------- Signed-off-by: Ross Golder <ross@golder.org>
This commit is contained in:
@@ -166,15 +166,11 @@ func Parse(f io.Reader, origin, fileName string, serial int64) (*Zone, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if !seenSOA {
|
||||
return nil, fmt.Errorf("file %q has no SOA record for origin %s", fileName, origin)
|
||||
}
|
||||
if zp.Err() != nil {
|
||||
return nil, fmt.Errorf("failed to parse file %q for origin %s with error %v", fileName, origin, zp.Err())
|
||||
}
|
||||
|
||||
if err := zp.Err(); err != nil {
|
||||
return nil, err
|
||||
if !seenSOA {
|
||||
return nil, fmt.Errorf("file %q has no SOA record for origin %s", fileName, origin)
|
||||
}
|
||||
|
||||
return z, nil
|
||||
|
||||
Reference in New Issue
Block a user