Skip to content

Commit d4f4f50

Browse files
committed
Merge pull request #34 from mboersma/better-client-error
ref(http.go): improve client error message
2 parents 6c176d2 + 69b226e commit d4f4f50

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

controller/client/http.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ func checkForErrors(res *http.Response, body string) error {
156156
// CheckConnection checks that the user is connected to a network and the URL points to a valid controller.
157157
func CheckConnection(client *http.Client, controllerURL url.URL) error {
158158
errorMessage := `%s does not appear to be a valid Deis controller.
159-
Make sure that the Controller URI is correct and the server is running.`
160-
161-
baseURL := controllerURL.String()
159+
Make sure that the Controller URI is correct, the server is running and
160+
your client version is correct.`
162161

163162
controllerURL.Path = "/v2/"
164163

@@ -172,13 +171,13 @@ Make sure that the Controller URI is correct and the server is running.`
172171
res, err := client.Do(req)
173172

174173
if err != nil {
175-
fmt.Printf(errorMessage+"\n", baseURL)
174+
fmt.Printf(errorMessage+"\n", controllerURL.String())
176175
return err
177176
}
178177
defer res.Body.Close()
179178

180179
if res.StatusCode != 401 {
181-
return fmt.Errorf(errorMessage, baseURL)
180+
return fmt.Errorf(errorMessage, controllerURL.String())
182181
}
183182

184183
checkAPICompatibility(res.Header.Get("DEIS_API_VERSION"))

0 commit comments

Comments
 (0)