Cloudwatch: Unwrap errors - throw error from upstream (#36334) (#37993)

* Unwrap errors - throw error from upstream

* Fixes according to reviewer's comments

* Fix linting

* Remove unused code

(cherry picked from commit 050dc7bc8f)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2021-08-18 21:34:02 +02:00
committed by GitHub
co-authored by Dimitris Sotirakis
parent 577d9d52f6
commit cfeb21b12c
2 changed files with 9 additions and 4 deletions
+3 -4
View File
@@ -6,14 +6,13 @@ import (
"net/http"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/expr"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/expr"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/util"
)
+6
View File
@@ -98,6 +98,12 @@ func (e *cloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, req *ba
}
if err := eg.Wait(); err != nil {
dataResponse := backend.DataResponse{
Error: fmt.Errorf("metric request error: %q", err),
}
resultChan <- &responseWrapper{
DataResponse: &dataResponse,
}
return nil, err
}
close(resultChan)