Skip to content

Commit

Permalink
Merge pull request #3 from bboreham/print-kube-error
Browse files Browse the repository at this point in the history
Print the body of any error response that comes back from Kubernetes
  • Loading branch information
sercand committed Nov 28, 2017
2 parents 7b3d514 + 7acc55f commit aa801ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kuberesolver

import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -66,7 +67,8 @@ func (r *kubeResolver) watch(target string, stopCh <-chan struct{}, resultCh cha
}
if resp.StatusCode != http.StatusOK {
defer resp.Body.Close()
return fmt.Errorf("invalid response code %d", resp.StatusCode)
rbody, _ := ioutil.ReadAll(resp.Body)
return fmt.Errorf("invalid response code %d: %s", resp.StatusCode, rbody)
}
sw := newStreamWatcher(resp.Body)
for {
Expand Down

0 comments on commit aa801ca

Please sign in to comment.