Skip to content

Commit 85c8e3d

Browse files
committed
closes #112. don't fatal on WalkDir issue. Return a warning, bail on that path, and continue execution.
1 parent 516356c commit 85c8e3d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

check/checkrr.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ func (c *Checkrr) Run() {
9696
for _, path := range c.config.GetStringSlice("checkpath") {
9797
c.Logger.WithFields(log.Fields{"startup": true}).Debugf("Path: %v", path)
9898

99-
filepath.WalkDir(path, func(path string, d os.DirEntry, err error) error {
99+
err := filepath.WalkDir(path, func(path string, d os.DirEntry, err error) error {
100100
if err != nil {
101-
c.Logger.Fatalf(err.Error()+" %v", path)
102-
return err
101+
c.Logger.Warnf("An error occurred walking the tree for %s. Please correct this before the next run.", path)
102+
return err // we need to return here. we will fail all checks otherwise.
103103
}
104104
if !d.IsDir() {
105105
var ignore bool = false
@@ -171,6 +171,9 @@ func (c *Checkrr) Run() {
171171
}
172172
return nil
173173
})
174+
if err != nil {
175+
c.Logger.WithFields(log.Fields{"run": "failed"}).Errorf("Error encountered in checkrr run: %s", err)
176+
}
174177
}
175178

176179
c.notifications.Notify("Checkrr Finished", "A checkrr run has ended", "endrun", "")

0 commit comments

Comments
 (0)