diff --git a/evaluator/evaluate.go b/evaluator/evaluate.go index bcd0079b5..8af76c84c 100644 --- a/evaluator/evaluate.go +++ b/evaluator/evaluate.go @@ -214,7 +214,7 @@ func evaluateInDatabase(ctx context.Context, event *mqueue.PlatformEvent, invent thirdParty, err := analyzeRepos(system) if err != nil { - return nil, nil, errors.Wrap(err, "Repo analysis failed") + return nil, nil, errors.Wrap(err, "repo analysis failed") } system.ThirdParty = thirdParty // to set "system_platform.third_party" column @@ -414,7 +414,7 @@ func tryGetSystem(accountID int, inventoryID string, system, err := loadSystemData(accountID, inventoryID) if err != nil { evaluationCnt.WithLabelValues("error-db-read-inventory-data").Inc() - return nil, errors.Wrap(err, "error loading system from DB") + return nil, base.WrapFatalDBError(err, "error loading system from DB") } if system.ID == 0 { evaluationCnt.WithLabelValues("error-db-read-inventory-data").Inc() @@ -496,7 +496,7 @@ func evaluateAndStore(system *models.SystemPlatform, err = commitWithObserve(tx) if err != nil { evaluationCnt.WithLabelValues("error-database-commit").Inc() - return errors.New("database commit failed") + return base.WrapFatalDBError(err, "database commit failed") } return nil diff --git a/evaluator/evaluate_baseline.go b/evaluator/evaluate_baseline.go index 193d9cee1..91fc1dd1e 100644 --- a/evaluator/evaluate_baseline.go +++ b/evaluator/evaluate_baseline.go @@ -1,6 +1,7 @@ package evaluator import ( + "app/base" "app/base/database" "app/base/models" "app/base/vmaas" @@ -24,7 +25,7 @@ func limitVmaasToBaseline(system *models.SystemPlatform, vmaasData *vmaas.Update Where("public_date >= ?", baselineConfig.ToTime.Truncate(24*time.Hour)). Pluck("name", &filterOutNames).Error if err != nil { - return err + return base.WrapFatalDBError(err, "load reported advisories") } // create map of advisories we need to filter out diff --git a/evaluator/remediations.go b/evaluator/remediations.go index a73f1d21a..a170fa216 100644 --- a/evaluator/remediations.go +++ b/evaluator/remediations.go @@ -82,7 +82,8 @@ func publishRemediationsState(system *models.SystemPlatform, response *vmaas.Upd state := createRemediationsStateMsg(system.InventoryID, response) msg, err := mqueue.MessageFromJSON(system.InventoryID, state) if err != nil { - return errors.Wrap(err, "Formatting message") + return errors.Wrap(err, "formatting message") } - return remediationsPublisher.WriteMessages(base.Context, msg) + err = remediationsPublisher.WriteMessages(base.Context, msg) + return base.WrapFatalKafkaError(err, "write message") }