SQL: Fix so that all captured errors are returned from sql engine (#32353)

This commit is contained in:
Marcus Efraimsson 2021-03-26 13:17:18 +01:00 committed by GitHub
parent c8afce5fd6
commit 5985c199ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,6 +185,7 @@ func (e *dataPlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
rows, err := db.Query(rawSQL)
if err != nil {
queryResult.Error = e.queryResultTransformer.TransformQueryError(err)
ch <- queryResult
return
}
defer func() {
@ -200,12 +201,14 @@ func (e *dataPlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
err := e.transformToTimeSeries(query, rows, &queryResult, queryContext)
if err != nil {
queryResult.Error = err
ch <- queryResult
return
}
case "table":
err := e.transformToTable(query, rows, &queryResult, queryContext)
if err != nil {
queryResult.Error = err
ch <- queryResult
return
}
}