Stop spurious APIFormat stopwatches logs (#20008)

If there are dangling stopwatches with missing issues there will be repeated
logging of Unable to APIFormat stopwatches. These are unhelpful and instead
we should only log if the error is not an issue not exist error.

And we should also prevent an error on missing issue in GetActiveStopwatch too

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath authored and GitHub committed 2022-06-17 22:47:15 +01:00
1 parent 5d80feb5a6
commit ae446b13f9
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -94,7 +94,9 @@ loop:
for _, userStopwatches := range usersStopwatches {
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
if err != nil {
log.Error("Unable to APIFormat stopwatches: %v", err)
if !issues_model.IsErrIssueNotExist(err) {
log.Error("Unable to APIFormat stopwatches: %v", err)
}
continue
}
dataBs, err := json.Marshal(apiSWs)