Skip to content

Commit

Permalink
fix(notifiers): proceed to next notification in case of errors at any…
Browse files Browse the repository at this point in the history
… place
  • Loading branch information
bsushmith committed Sep 11, 2023
1 parent 5a2c4fb commit 72ceb18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/notifiers/slack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ func (n *Notifier) Notify(items []domain.Notification) []error {
ws, err := n.getSlackWorkspaceForUser(item.User)
if err != nil {
errs = append(errs, fmt.Errorf("%v | %w", labelSlice, err))
continue
}
slackID, err = n.findSlackIDByEmail(item.User, ws)
if err != nil {
errs = append(errs, fmt.Errorf("%v | %w", labelSlice, err))
continue
}

// cache
Expand All @@ -103,10 +105,12 @@ func (n *Notifier) Notify(items []domain.Notification) []error {
msg, err := ParseMessage(item.Message, n.Messages, n.defaultMessageFiles)
if err != nil {
errs = append(errs, fmt.Errorf("%v | error parsing message : %w", labelSlice, err))
continue
}

if err := n.sendMessage(ws, slackID, msg); err != nil {
errs = append(errs, fmt.Errorf("%v | error sending message to user:%s in workspace:%s | %w", labelSlice, item.User, ws.WorkspaceName, err))
continue
}
}

Expand Down

0 comments on commit 72ceb18

Please sign in to comment.