mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: cloudwatch corrected error handling so original error is not thrown away
This commit is contained in:
@@ -3,6 +3,7 @@ package cloudwatch
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -191,11 +192,11 @@ func (e *CloudWatchExecutor) executeMetricFindQuery(ctx context.Context, queryCo
|
|||||||
dsInfo := e.getDsInfo(region)
|
dsInfo := e.getDsInfo(region)
|
||||||
cfg, err := e.getAwsConfig(dsInfo)
|
cfg, err := e.getAwsConfig(dsInfo)
|
||||||
if err != nil {
|
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)
|
sess, err := session.NewSession(cfg)
|
||||||
if err != nil {
|
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)
|
e.ec2Svc = ec2.New(sess, cfg)
|
||||||
|
|
||||||
@@ -478,7 +479,7 @@ func (e *CloudWatchExecutor) cloudwatchListMetrics(region string, namespace stri
|
|||||||
return !lastPage
|
return !lastPage
|
||||||
})
|
})
|
||||||
if err != nil {
|
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
|
return &resp, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user