Skip to content

Commit

Permalink
better errors for slackCatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewboyle committed Apr 13, 2019
1 parent d2b8231 commit 51001d6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions catchers/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func NewSlack(webhookurl string) *Slack {
}
}


//HandlePanic is the function that will be called in the panic handle middleware if your program panics.
// It takes a message that will be written to the webhook if your server does panic.
// HandlePanic can return an error if it cannot marshall the message into JSON, building a request fails, or the call to Slack fails.
Expand All @@ -48,9 +47,9 @@ func (s Slack) HandlePanic(message string) error {
if err != nil {
return err
}
_, err = s.httpClient.Do(req)
res, err := s.httpClient.Do(req)

if err != nil {
if err != nil || res.StatusCode >= 400 {
return ErrSlackCallFailed
}
return err
Expand Down

0 comments on commit 51001d6

Please sign in to comment.