mirror of
https://github.com/coredns/coredns.git
synced 2026-05-26 03:40:23 -04:00
lint(errorlint): handle wrapped errors
Enable errorlint and preserve wrapped error chains so runtime checks and tests classify failures correctly. This also makes Route53 surface insert failures instead of silently dropping them. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -167,7 +167,7 @@ func Parse(f io.Reader, origin, fileName string, serial int64) (*Zone, error) {
|
||||
}
|
||||
}
|
||||
if zp.Err() != nil {
|
||||
return nil, fmt.Errorf("failed to parse file %q for origin %s with error %v", fileName, origin, zp.Err())
|
||||
return nil, fmt.Errorf("failed to parse file %q for origin %s with error %w", fileName, origin, zp.Err())
|
||||
}
|
||||
if !seenSOA {
|
||||
return nil, fmt.Errorf("file %q has no SOA record for origin %s", fileName, origin)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -30,7 +31,8 @@ func (z *Zone) Reload(t *transfer.Transfer) error {
|
||||
zone, err := Parse(reader, z.origin, zFile, serial)
|
||||
reader.Close()
|
||||
if err != nil {
|
||||
if _, ok := err.(*serialErr); !ok {
|
||||
var serialErr *serialErr
|
||||
if !errors.As(err, &serialErr) {
|
||||
log.Errorf("Parsing zone %q: %v", z.origin, err)
|
||||
}
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user