Skip to content

Commit

Permalink
Merge pull request #68 from status-im/fix/optional-log
Browse files Browse the repository at this point in the history
fix: add option to log when appending error
  • Loading branch information
adklempner authored Oct 21, 2024
2 parents 9c25d22 + 467f3c5 commit ab3fd88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func NewMetricErrors(logger *zap.Logger) *MetricErrors {
}
}

func (me *MetricErrors) Append(id int, err string) {
if me.logger != nil {
func (me *MetricErrors) Append(id int, err string, skipLogging ...bool) {
if me.logger != nil && (len(skipLogging) == 0 || !skipLogging[0]) {
me.logger.Error(err)
}
me.mutex.Lock()
Expand Down
2 changes: 1 addition & 1 deletion telemetry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (s *Server) createWakuTelemetry(w http.ResponseWriter, r *http.Request) {
}
if err := pushFilter.Put(s.DB); err != nil {
if strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
errorDetails.Append(data.Id, "Error saving lightpush/filter metric: Duplicate key value violates unique constraint")
errorDetails.Append(data.Id, "Error saving lightpush/filter metric: Duplicate key value violates unique constraint", true)
continue
}
errorDetails.Append(data.Id, fmt.Sprintf("Error saving lightpush/filter metric: %v", err))
Expand Down

0 comments on commit ab3fd88

Please sign in to comment.