Skip to content

Commit

Permalink
Merge pull request #183 from airbrake/remote-config-error-message
Browse files Browse the repository at this point in the history
remote_config: improve error message when config is not fetched
  • Loading branch information
kyrylo authored Sep 8, 2020
2 parents 985f774 + 9c62c8d commit 080e728
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Gobrake Changelog

### master

* Remote config: improved error message when config cannot be requested from S3
([#178](https://github.com/airbrake/gobrake/pull/178))

### [v5.0.1][v5.0.1] (September 1, 2020)

* Fixed bug where `gobrake: span="http.client" is already finished gets printed`
Expand Down
7 changes: 5 additions & 2 deletions remote_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ func (rc *remoteConfig) Poll() {
}

func (rc *remoteConfig) tick() error {
body, err := rc.fetchConfig(rc.ConfigRoute(rc.opt.RemoteConfigHost))
route := rc.ConfigRoute(rc.opt.RemoteConfigHost)
body, err := rc.fetchConfig(route)
if err != nil {
return fmt.Errorf("fetchConfig failed: %s", err)
return fmt.Errorf(
"fetchConfig failed for %s. Reason: %s", route, err,
)
}
if err = json.Unmarshal(body, rc.JSON); err != nil {
return fmt.Errorf("parseConfig failed: %s", err)
Expand Down
10 changes: 4 additions & 6 deletions remote_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ var _ = Describe("newRemoteConfig", func() {
rc.Poll()
rc.StopPolling()

Expect(logBuf.String()).To(
ContainSubstring("fetchConfig failed: not found"),
)
Expect(logBuf.String()).To(ContainSubstring("fetchConfig failed"))
Expect(logBuf.String()).To(ContainSubstring("not found"))
})
})

Expand All @@ -147,9 +146,8 @@ var _ = Describe("newRemoteConfig", func() {
rc.Poll()
rc.StopPolling()

Expect(logBuf.String()).To(
ContainSubstring("fetchConfig failed: forbidden"),
)
Expect(logBuf.String()).To(ContainSubstring("fetchConfig failed"))
Expect(logBuf.String()).To(ContainSubstring("forbidden"))
})
})

Expand Down

0 comments on commit 080e728

Please sign in to comment.