ignore empty ("") errors.

pull/75/head
Jason Kulatunga 4 years ago
parent c8a4be6b07
commit ac7c1f28cf

@ -202,22 +202,21 @@ func (n *Notify) SendShoutrrrNotification(shoutrrrUrl string) error {
errs := sender.Send(n.Payload.Message, params) errs := sender.Send(n.Payload.Message, params)
if len(errs) > 0 { if len(errs) > 0 {
n.Logger.Errorf("One or more errors occurred occurred while sending notifications for %s:", shoutrrrUrl)
var errstrings []string var errstrings []string
for _, err := range errs { for _, err := range errs {
if err == nil || err.Error() == "" { if err == nil || err.Error() == "" {
continue continue
} }
n.Logger.Error(err)
errstrings = append(errstrings, err.Error()) errstrings = append(errstrings, err.Error())
} }
//sometimes there are empty errs, we're going to skip them. //sometimes there are empty errs, we're going to skip them.
if len(errstrings) == 0 { if len(errstrings) == 0 {
return nil return nil
} else { } else {
n.Logger.Errorf("One or more errors occurred while sending notifications for %s:", shoutrrrUrl)
n.Logger.Error(errs)
return errors.New(strings.Join(errstrings, "\n")) return errors.New(strings.Join(errstrings, "\n"))
} }
} }
return nil return nil

Loading…
Cancel
Save