Skip to content

Commit

Permalink
add reason code to slack notifier
Browse files Browse the repository at this point in the history
this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial #3231
  • Loading branch information
gotjosh committed Feb 15, 2023
1 parent fe1b045 commit c9c307a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion notify/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
// https://api.slack.com/changelog/2016-05-17-changes-to-errors-for-incoming-webhooks
retry, err := n.retrier.Check(resp.StatusCode, resp.Body)
err = errors.Wrap(err, fmt.Sprintf("channel %q", req.Channel))
return retry, err
reasonErr := notify.NewErrorWithReason(notify.GetFailureReasonFromStatusCode(resp.StatusCode), err)

return retry, reasonErr
}

0 comments on commit c9c307a

Please sign in to comment.