From 2782ad09553d79705152361e72074a8cd3df8182 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 29 Jan 2018 09:52:35 +0100 Subject: [PATCH] plugins: only set error if errorstring is not empty --- .../datasource/wrapper/datasource_plugin_wrapper.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go b/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go index 91511f96685..f9c9f9d3b16 100644 --- a/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go +++ b/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go @@ -69,10 +69,13 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou for _, r := range pbres.Results { qr := &tsdb.QueryResult{ - RefId: r.RefId, - Series: []*tsdb.TimeSeries{}, - Error: errors.New(r.Error), - ErrorString: r.Error, + RefId: r.RefId, + Series: []*tsdb.TimeSeries{}, + } + + if r.Error != "" { + qr.Error = errors.New(r.Error) + qr.ErrorString = r.Error } for _, s := range r.GetSeries() {