checker: Cleanup error handling code

This change only moves code around but does not result in any change in
behavior.
This commit is contained in:
Michael Eischer 2020-03-07 14:10:34 +01:00
parent 0f67ae813a
commit ef325ffc02
1 changed files with 2 additions and 8 deletions

View File

@ -537,13 +537,12 @@ func (c *Checker) filterTrees(ctx context.Context, backlog restic.IDs, loaderCha
debug.Log("input job tree %v", j.ID)
var err error
if j.error != nil {
debug.Log("received job with error: %v (tree %v, ID %v)", j.error, j.Tree, j.ID)
} else if j.Tree == nil {
debug.Log("received job with nil tree pointer: %v (ID %v)", j.error, j.ID)
err = errors.New("tree is nil and error is nil")
// send a new job with the new error instead of the old one
j = treeJob{ID: j.ID, error: errors.New("tree is nil and error is nil")}
} else {
subtrees := j.Tree.Subtrees()
debug.Log("subtrees for tree %v: %v", j.ID, subtrees)
@ -561,11 +560,6 @@ func (c *Checker) filterTrees(ctx context.Context, backlog restic.IDs, loaderCha
}
}
if err != nil {
// send a new job with the new error instead of the old one
j = treeJob{ID: j.ID, error: err}
}
job = j
outCh = out
inCh = nil