mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 21:53:00 +08:00
SQL data sources: Use correct error source for sql processing errors (#100872)
* SQL data sources: Use correct error source for sql processing errors * Fix lint * Fix cyclomatic complexity * Nit rename variable to make it more clear what those errors are
This commit is contained in:
@ -231,7 +231,7 @@ func (e *DataSourceHandler) executeQuery(query backend.DataQuery, wg *sync.WaitG
|
||||
emptyFrame.SetMeta(&data.FrameMeta{
|
||||
ExecutedQueryString: query,
|
||||
})
|
||||
if backend.IsDownstreamError(err) {
|
||||
if isDownstreamError(err) {
|
||||
source = backend.ErrorSourceDownstream
|
||||
}
|
||||
queryResult.dataResponse.Error = fmt.Errorf("%s: %w", frameErr, err)
|
||||
@ -642,3 +642,20 @@ func epochPrecisionToMS(value float64) float64 {
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func isDownstreamError(err error) bool {
|
||||
if backend.IsDownstreamError(err) {
|
||||
return true
|
||||
}
|
||||
resultProcessingDownstreamErrors := []error{
|
||||
data.ErrorInputFieldsWithoutRows,
|
||||
data.ErrorSeriesUnsorted,
|
||||
data.ErrorNullTimeValues,
|
||||
}
|
||||
for _, e := range resultProcessingDownstreamErrors {
|
||||
if errors.Is(err, e) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user