Changing the DigitalOcean Droplet 404 from a message string to an actual 404 status code

This commit is contained in:
stack72 2015-11-05 16:33:29 +00:00
parent 032a42797e
commit 2504cb4624
1 changed files with 2 additions and 2 deletions

View File

@ -186,10 +186,10 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
}
// Retrieve the droplet properties for updating the state
droplet, _, err := client.Droplets.Get(id)
droplet, resp, err := client.Droplets.Get(id)
if err != nil {
// check if the droplet no longer exists.
if strings.Contains(err.Error(), "404 The resource you were accessing could not be found") {
if resp.StatusCode == 404 {
d.SetId("")
return nil
}