Skip to content

Commit

Permalink
Better guard error handler function
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Dwyer <Brian.Dwyer@broadridge.com>
  • Loading branch information
bdwyertech committed Jul 13, 2020
1 parent cf2c46c commit 930648c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ func main() {
cfr, err := cfclient.SignalResource(signal)
// Error Handling
// We don't want to have a non-zero exit code cause cloud-init unit failure during autoscaling operations
func() {
if err != nil {
if err != nil {
func() {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == "ValidationError" {
if strings.HasSuffix(awsErr.Message(), "is in CREATE_COMPLETE state and cannot be signaled") {
Expand All @@ -154,8 +154,8 @@ func main() {
}
}
log.Fatal(err)
}
}()
}()
}

log.Println("SignalResource Response:", cfr)
}
Expand Down

0 comments on commit 930648c

Please sign in to comment.