Skip to content

Commit

Permalink
Merge pull request hashicorp#11360 from hashicorp/asg-hook-errors
Browse files Browse the repository at this point in the history
provider/aws: Improve error message from ASG Hooks
  • Loading branch information
jen20 authored Jan 23, 2017
2 parents 86b53bf + b95faa3 commit 19e5545
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions builtin/providers/aws/resource_aws_autoscaling_lifecycle_hook.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package aws

import (
"fmt"
"log"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
)
Expand Down Expand Up @@ -67,10 +67,10 @@ func resourceAwsAutoscalingLifecycleHookPutOp(conn *autoscaling.AutoScaling, par
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
if strings.Contains(awsErr.Message(), "Unable to publish test message to notification target") {
return resource.RetryableError(fmt.Errorf("[DEBUG] Retrying AWS AutoScaling Lifecycle Hook: %s", params))
return resource.RetryableError(errwrap.Wrapf("[DEBUG] Retrying AWS AutoScaling Lifecycle Hook: {{err}}", awsErr))
}
}
return resource.NonRetryableError(fmt.Errorf("Error putting lifecycle hook: %s", err))
return resource.NonRetryableError(errwrap.Wrapf("Error putting lifecycle hook: {{err}}", err))
}
return nil
})
Expand Down Expand Up @@ -127,7 +127,7 @@ func resourceAwsAutoscalingLifecycleHookDelete(d *schema.ResourceData, meta inte
LifecycleHookName: aws.String(d.Get("name").(string)),
}
if _, err := autoscalingconn.DeleteLifecycleHook(&params); err != nil {
return fmt.Errorf("Autoscaling Lifecycle Hook: %s ", err)
return errwrap.Wrapf("Autoscaling Lifecycle Hook: {{err}}", err)
}

d.SetId("")
Expand Down Expand Up @@ -178,7 +178,7 @@ func getAwsAutoscalingLifecycleHook(d *schema.ResourceData, meta interface{}) (*
log.Printf("[DEBUG] AutoScaling Lifecycle Hook Describe Params: %#v", params)
resp, err := autoscalingconn.DescribeLifecycleHooks(&params)
if err != nil {
return nil, fmt.Errorf("Error retrieving lifecycle hooks: %s", err)
return nil, errwrap.Wrapf("Error retrieving lifecycle hooks: {{err}}", err)
}

// find lifecycle hooks
Expand Down

0 comments on commit 19e5545

Please sign in to comment.