Skip to content

Commit

Permalink
custom_image: Surface a better error to users if image import fails. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething committed Apr 26, 2021
1 parent a3613a3 commit b8d53f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions digitalocean/resource_digitalocean_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package digitalocean

import (
"context"
"fmt"
"log"
"strconv"
"strings"
Expand Down Expand Up @@ -246,6 +247,11 @@ func imageStateRefreshFunc(ctx context.Context, d *schema.ResourceData, state st
if err != nil {
return nil, "", err
}

if imageResponse.Status == imageDeletedStatus {
return nil, "", fmt.Errorf(imageResponse.ErrorMessage)
}

return imageResponse, imageResponse.Status, nil
}
}
Expand Down

0 comments on commit b8d53f8

Please sign in to comment.