Skip to content

Commit

Permalink
Merge pull request #20 from snikch/stop-swallowing-delivery-errors
Browse files Browse the repository at this point in the history
Don't swallow errors in a goroutine
  • Loading branch information
martin308 committed Aug 18, 2015
2 parents 13fd6b8 + 139d63f commit 9ee24c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ func (notifier *Notifier) Notify(err error, rawData ...interface{}) (e error) {
if config.Synchronous {
return (&payload{event, config}).deliver()
}
go (&payload{event, config}).deliver()
// Ensure that any errors are logged if they occur in a goroutine.
go func(event *Event, config *Configuration) {
err := (&payload{event, config}).deliver()
if err != nil {
config.log("bugsnag.Notify: %v", err)
}
}(event, config)

return nil
}
return fmt.Errorf("not notifying in %s", config.ReleaseStage)
Expand Down

0 comments on commit 9ee24c1

Please sign in to comment.