From 950de0f78f1bcc801b00fc64034b530c0c21b5db Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 15 Jul 2016 12:53:14 -0600 Subject: [PATCH] Return error slice instead of single error --- .../aws/resource_aws_elastic_beanstalk_environment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/providers/aws/resource_aws_elastic_beanstalk_environment.go b/builtin/providers/aws/resource_aws_elastic_beanstalk_environment.go index ba49b343f3a4..5adc793fe157 100644 --- a/builtin/providers/aws/resource_aws_elastic_beanstalk_environment.go +++ b/builtin/providers/aws/resource_aws_elastic_beanstalk_environment.go @@ -702,7 +702,7 @@ func dropGeneratedSecurityGroup(settingValue string, meta interface{}) string { return strings.Join(legitGroups, ",") } -func describeBeanstalkErrors(conn *elasticbeanstalk.ElasticBeanstalk, environmentId string, t time.Time) error { +func describeBeanstalkErrors(conn *elasticbeanstalk.ElasticBeanstalk, environmentId string, t time.Time) []error { beanstalkErrors, err := conn.DescribeEvents(&elasticbeanstalk.DescribeEventsInput{ EnvironmentId: aws.String(environmentId), Severity: aws.String("ERROR"), @@ -713,13 +713,13 @@ func describeBeanstalkErrors(conn *elasticbeanstalk.ElasticBeanstalk, environmen log.Printf("[Err] Unable to get Elastic Beanstalk Evironment events: %s", err) } - events := "" + var events []error for _, event := range beanstalkErrors.Events { - events = events + "\n" + event.EventDate.String() + ": " + *event.Message + events = append(events, fmt.Errorf(event.EventDate.String()+": "+*event.Message)) } - if events != "" { - return fmt.Errorf("%s", events) + if len(events) > 0 { + return events } return nil