From a9a5bf4352d7b612592f474e3dd7aa22dc7818fb Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 7 Jun 2023 14:45:11 -0500 Subject: [PATCH] :loud_sound: Log an error and continue if an integration fails to send --- internal/domain/domain.go | 8 ++------ internal/integration/integration.go | 7 +++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/internal/domain/domain.go b/internal/domain/domain.go index e6d5535..700ac08 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -77,9 +77,7 @@ func (d *Domain) NotifyThreshold() error { for _, threshold := range viper.GetIntSlice("threshold") { if d.TriggeredThreshold != threshold && daysLeft <= threshold { msg := message.NewThresholdMessage(d.Name, daysLeft) - if err := integration.Send(msg); err != nil { - return err - } + integration.Send(msg) d.TriggeredThreshold = threshold break } @@ -97,9 +95,7 @@ func (d *Domain) NotifyStatusChange() error { if len(changes) > 0 { msg := message.NewStatusChangedMessage(d.Name, changes) - if err := integration.Send(msg); err != nil { - return err - } + integration.Send(msg) } } return nil diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 8770b95..bcb865c 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -49,13 +49,12 @@ func Setup() error { return nil } -func Send(message string) error { - for _, integration := range Default { +func Send(message string) { + for name, integration := range Default { if err := integration.Send(message); err != nil { - return err + log.WithField("integration", name).Error(err) } } - return nil } func Get(key string) Integration {