@@ -13,6 +13,7 @@ import (
13
13
"syscall"
14
14
"time"
15
15
16
+ "github.com/pkg/errors"
16
17
"github.com/prometheus/client_golang/prometheus"
17
18
"github.com/prometheus/client_golang/prometheus/promhttp"
18
19
"github.com/prometheus/common/log"
@@ -155,7 +156,7 @@ func runAPIPolling(done chan error, url, token string, organizationIDs []string,
155
156
return nil
156
157
})
157
158
if err != nil {
158
- done <- err
159
+ done <- errors . WithMessagef ( err , "organization %s (%s)" , organization . Name , organization . ID )
159
160
return
160
161
}
161
162
gaugeResults = append (gaugeResults , results ... )
@@ -175,6 +176,7 @@ func runAPIPolling(done chan error, url, token string, organizationIDs []string,
175
176
func poll (organization org , collector func (org ) error ) error {
176
177
err := collector (organization )
177
178
if err != nil {
179
+ err = errors .Cause (err )
178
180
httpErr , ok := err .(* url.Error )
179
181
if ok {
180
182
if httpErr .Timeout () {
@@ -252,7 +254,7 @@ type gaugeResult struct {
252
254
func collect (client * client , organization org ) ([]gaugeResult , error ) {
253
255
projects , err := client .getProjects (organization .ID )
254
256
if err != nil {
255
- return nil , err
257
+ return nil , errors . WithMessage ( err , "get projects for organization" )
256
258
}
257
259
258
260
var gaugeResults []gaugeResult
0 commit comments