Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/vpc_dhcp_options: Update not found error message #4136

Merged
merged 2 commits into from
Apr 12, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws/resource_aws_vpc_dhcp_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func resourceDHCPOptionsStateRefreshFunc(conn *ec2.EC2, id string) resource.Stat

resp, err := conn.DescribeDhcpOptions(DescribeDhcpOpts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidDhcpOptionsID.NotFound" {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidDhcpOptionID.NotFound" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using isAWSErr:

if isAWSErr(err, "InvalidDhcpOptionID.NotFound", "") {

or even extracting to own function

func isNoSuchDhcpOptionIDErr(err error) bool {
    return isAWSErr(err, "InvalidDhcpOptionID.NotFound", "")
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check for both forms if you extract to a new function?
It seems both error messages have exactly the same description.

resp = nil
} else {
log.Printf("Error on DHCPOptionsStateRefresh: %s", err)
Expand Down