builder/digitalocean: print bad status code as string
This commit is contained in:
parent
1e6780e496
commit
46d3e7c1a4
|
@ -154,15 +154,14 @@ func NewRequest(d DigitalOceanClient, path string, params string) (map[string]in
|
||||||
|
|
||||||
err = json.Unmarshal(body, &decodedResponse)
|
err = json.Unmarshal(body, &decodedResponse)
|
||||||
|
|
||||||
|
log.Printf("response from digitalocean: %v", decodedResponse)
|
||||||
|
|
||||||
// Catch all non-200 status and return an error
|
// Catch all non-200 status and return an error
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
err = errors.New(fmt.Sprintf("Recieved non-200 HTTP status from DigitalOcean: %d", resp.StatusCode))
|
err = errors.New(fmt.Sprintf("Received non-200 HTTP status from DigitalOcean: %v", resp.StatusCode))
|
||||||
log.Printf("response from digital ocean: %v", decodedResponse)
|
|
||||||
return decodedResponse, err
|
return decodedResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("response from digital ocean: %v", decodedResponse)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return decodedResponse, err
|
return decodedResponse, err
|
||||||
}
|
}
|
||||||
|
@ -174,8 +173,7 @@ func NewRequest(d DigitalOceanClient, path string, params string) (map[string]in
|
||||||
if status == "ERROR" {
|
if status == "ERROR" {
|
||||||
status = decodedResponse["error_message"]
|
status = decodedResponse["error_message"]
|
||||||
}
|
}
|
||||||
err = errors.New(fmt.Sprintf("Recieved bad status from DigitalOcean: %v", status))
|
err = errors.New(fmt.Sprintf("Received bad status from DigitalOcean: %v", status))
|
||||||
log.Printf("response from digital ocean: %v", decodedResponse)
|
|
||||||
return decodedResponse, err
|
return decodedResponse, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue