Skip to content

Commit

Permalink
Improve error handling of outgoing webhook notifier (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris O'Brien <[email protected]>
  • Loading branch information
chrisob authored and jpweber committed Nov 22, 2019
1 parent 14eed06 commit e68287c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ func (n *NotificationSet) genericWebHook(jsonBody []byte) {
n.Config.HTTPEndpoint,
bytes.NewBuffer(jsonBody),
)
if err != nil {
log.Error("Error:", err)
// If we couldn't create a request object, we have nothing to send
return
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Error("Error:", err)
// Sending the webhook failed, so don't attempt to process the response
return
}
defer resp.Body.Close()

Expand Down

0 comments on commit e68287c

Please sign in to comment.