Merge pull request #26354 from csrwng/fix_visitor_error

Automatic merge from submit-queue

kubectl: fix URLVisitor error message

The status of a failed fetch will usually include the code, resulting in a duplicate code in the error message:
```
unable to read URL "http://git:8080/ruby-hello-world.git", server reported 401 401 Unauthorized
```

This change rearranges them so at least the message doesn't stutter (and includes the code in case it's not part of the status):
```
unable to read URL "http://git:8080/ruby-hello-world.git", server reported 401 Unauthorized, status code 401
```

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
This commit is contained in:
k8s-merge-robot 2016-06-09 02:43:27 -07:00
commit f1ccc2f1be

View File

@ -259,7 +259,7 @@ func readHttpWithRetries(get httpget, duration time.Duration, u string, attempts
// Error - Set the error condition from the StatusCode
if statusCode != 200 {
err = fmt.Errorf("unable to read URL %q, server reported %d %s", u, statusCode, status)
err = fmt.Errorf("unable to read URL %q, server reported %s, status code=%d", u, status, statusCode)
}
if statusCode >= 500 && statusCode < 600 {