cloud-nuke
cloud-nuke copied to clipboard
Improve error handling for common/known errors
The logic for error handling is the same in the nuke default Ingress/Egress SG:
if awsErr, isAwsErr := err.(awserr.Error); isAwsErr && awsErr.Code() == "InvalidPermission.NotFound" {
logging.Logger.Debugf("Egress rule not present (ok)")
} else {
return fmt.Errorf("error deleting ingress rule: %s", errors.WithStackTrace(err))
}
The pattern awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "xpto" is common through the codebase.
Originally posted by @denis256 in https://github.com/gruntwork-io/cloud-nuke/pull/401#discussion_r1087905689