Handle 400 status from API

This commit is contained in:
Marcin Kulik
2015-03-23 17:48:25 +01:00
parent c72bab9ef5
commit ec6d893405

View File

@@ -110,6 +110,8 @@ func extractBody(response *http.Response) (string, error) {
func handleError(response *http.Response, body string) error { func handleError(response *http.Response, body string) error {
switch response.StatusCode { switch response.StatusCode {
case 400:
return fmt.Errorf("Invalid request: %v", body)
case 404: case 404:
return errors.New("Your client version is no longer supported. Please upgrade to the latest version.") return errors.New("Your client version is no longer supported. Please upgrade to the latest version.")
case 413: case 413: