Skip to content

Commit

Permalink
Handle error even if the logger is nil (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant authored Mar 29, 2021
1 parent a045071 commit c101f1a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/notifier/notifier_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ func (c *WebhookNotifier) Notify(diff model.DiffCache, wg *sync.WaitGroup) {
}
response, err := c.HTTPClient.Do(&request)
// Log if something went wrong while calling the webhook.
if err != nil && c.Logger != nil {
c.Logger.Printf("[%v] error: while calling webhook: %v\n", date, err)
if err != nil {
if c.Logger != nil {
c.Logger.Printf("[%v] error: while calling webhook: %v\n", date, err)
}
return
}
defer response.Body.Close()
Expand Down

0 comments on commit c101f1a

Please sign in to comment.