Commit 4067bab3 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/digitalocean: don't panic if error contains no message [GH-492]

parent 8821ef4d
......@@ -3,6 +3,8 @@
BUG FIXES:
* builder/all: timeout waiting for SSH connection is a failure. [GH-491]
* builder/digitalocean: don't panic if erroneous API response doesn't
contain error message. [GH-492]
* builder/virtualbox: error if VirtualBox version cant be detected. [GH-488]
* builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488]
......
......@@ -227,7 +227,13 @@ func NewRequest(d DigitalOceanClient, path string, params url.Values) (map[strin
}
if status == "ERROR" {
status = decodedResponse["message"].(string)
statusRaw, ok := decodedResponse["message"]
if ok {
status = statusRaw.(string)
} else {
status = fmt.Sprintf(
"Unknown error. Full response body: %s", body)
}
}
lastErr = errors.New(fmt.Sprintf("Received error from DigitalOcean (%d): %s",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment