Skip to content

Commit

Permalink
Merge pull request #317 from Shopify/switch-panic-to-error
Browse files Browse the repository at this point in the history
Only log when failing to call report state callback
  • Loading branch information
tiwilliam authored Oct 29, 2021
2 parents a336eb2 + c08d05d commit 17b883e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ferry.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,13 +1046,14 @@ func (f *Ferry) ReportState() {
callback := f.Config.StateCallback
state, err := f.SerializeStateToJSON()
if err != nil {
f.logger.Panicf("failed to serialize state to JSON: %s", err)
f.logger.WithError(err).Error("failed to serialize state to JSON")
return
}

callback.Payload = string(state)
err = callback.Post(&http.Client{})
if err != nil {
f.logger.Panicf("failed to post state to callback: %s with err: %s", callback, err)
f.logger.WithError(err).Errorf("failed to post state to callback %s", callback.URI)
}
}

Expand Down

0 comments on commit 17b883e

Please sign in to comment.