Make sure high level retries show with -q - fixes #648
Also update the exit code documentation describing that.
This commit is contained in:
parent
bbf819e2d1
commit
4001e21624
3 changed files with 23 additions and 12 deletions
11
cmd/cmd.go
11
cmd/cmd.go
|
@ -161,20 +161,23 @@ func Run(Retry bool, cmd *cobra.Command, f func() error) {
|
|||
for try := 1; try <= *retries; try++ {
|
||||
err = f()
|
||||
if !Retry || (err == nil && !fs.Stats.Errored()) {
|
||||
if try > 1 {
|
||||
fs.ErrorLog(nil, "Attempt %d/%d succeeded", try, *retries)
|
||||
}
|
||||
break
|
||||
}
|
||||
if fs.IsFatalError(err) {
|
||||
fs.Log(nil, "Fatal error received - not attempting retries")
|
||||
fs.ErrorLog(nil, "Fatal error received - not attempting retries")
|
||||
break
|
||||
}
|
||||
if fs.IsNoRetryError(err) {
|
||||
fs.Log(nil, "Can't retry this error - not attempting retries")
|
||||
fs.ErrorLog(nil, "Can't retry this error - not attempting retries")
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
fs.Log(nil, "Attempt %d/%d failed with %d errors and: %v", try, *retries, fs.Stats.GetErrors(), err)
|
||||
fs.ErrorLog(nil, "Attempt %d/%d failed with %d errors and: %v", try, *retries, fs.Stats.GetErrors(), err)
|
||||
} else {
|
||||
fs.Log(nil, "Attempt %d/%d failed with %d errors", try, *retries, fs.Stats.GetErrors())
|
||||
fs.ErrorLog(nil, "Attempt %d/%d failed with %d errors", try, *retries, fs.Stats.GetErrors())
|
||||
}
|
||||
if try < *retries {
|
||||
fs.Stats.ResetErrors()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue