Skip to content

Commit 5d03680

Browse files
authored
fix: do not prompt for restart on any db error, do not log not found errors (#435)
This fixes a bug where the log would prompt for a backend restart on any unknown database error. This does not make sense as e.g. unique constraint errors are not connection errors, but data errors that need to be fixed by the user or client. This also turns off logging for "not found" errors where no record exists that matches the query as this could be confusing when analyzing the log - a record not existing is not an error in the sense of our functionality here.
1 parent 65fc9d2 commit 5d03680

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controllers/database.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ func TryDBConnect(e error) error {
5050
return errors.New("database is read-only")
5151
}
5252

53-
log.Warn().Str("db", "unknown database error, restart the backend").Err(e).Msg("TryDBConnect")
53+
if e != gorm.ErrRecordNotFound {
54+
log.Info().Err(e).Msg("Database")
55+
}
5456
return e
5557
}
5658

0 commit comments

Comments
 (0)