From 4f59d229fe92d4d0d0223a587039693a07f59188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 19 Jan 2018 09:24:44 +0100 Subject: [PATCH] fix: cloudwatch corrected error handling so original error is not thrown away --- pkg/tsdb/cloudwatch/metric_find_query.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/tsdb/cloudwatch/metric_find_query.go b/pkg/tsdb/cloudwatch/metric_find_query.go index befaf8e1276..c6645647be9 100644 --- a/pkg/tsdb/cloudwatch/metric_find_query.go +++ b/pkg/tsdb/cloudwatch/metric_find_query.go @@ -3,6 +3,7 @@ package cloudwatch import ( "context" "errors" + "fmt" "reflect" "sort" "strings" @@ -191,11 +192,11 @@ func (e *CloudWatchExecutor) executeMetricFindQuery(ctx context.Context, queryCo dsInfo := e.getDsInfo(region) cfg, err := e.getAwsConfig(dsInfo) if err != nil { - return nil, errors.New("Failed to call ec2:DescribeInstances") + return nil, fmt.Errorf("Failed to call ec2:DescribeInstances, %v", err) } sess, err := session.NewSession(cfg) if err != nil { - return nil, errors.New("Failed to call ec2:DescribeInstances") + return nil, fmt.Errorf("Failed to call ec2:DescribeInstances, %v", err) } e.ec2Svc = ec2.New(sess, cfg) @@ -478,7 +479,7 @@ func (e *CloudWatchExecutor) cloudwatchListMetrics(region string, namespace stri return !lastPage }) if err != nil { - return nil, errors.New("Failed to call cloudwatch:ListMetrics") + return nil, fmt.Errorf("Failed to call cloudwatch:ListMetrics, %v", err) } return &resp, nil