From d44d3bd6aae6e5eb188734244a46a55c88679495 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:30:20 +0100 Subject: [PATCH] Fix error source for invalid queries (#1059) --- .changeset/friendly-panthers-yell.md | 5 +++++ pkg/models/query.go | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changeset/friendly-panthers-yell.md diff --git a/.changeset/friendly-panthers-yell.md b/.changeset/friendly-panthers-yell.md new file mode 100644 index 000000000..07994b63a --- /dev/null +++ b/.changeset/friendly-panthers-yell.md @@ -0,0 +1,5 @@ +--- +'grafana-infinity-datasource': patch +--- + +Fix error source for invalid queries diff --git a/pkg/models/query.go b/pkg/models/query.go index 51aeaa80f..00f16a615 100644 --- a/pkg/models/query.go +++ b/pkg/models/query.go @@ -310,8 +310,7 @@ func LoadQuery(ctx context.Context, backendQuery backend.DataQuery, pluginContex var query Query err := json.Unmarshal(backendQuery.JSON, &query) if err != nil { - // Plugin error as the user should not have been able to send a bad query - return query, errorsource.PluginError(fmt.Errorf("error while parsing the query json. %w", err), false) + return query, errorsource.DownstreamError(fmt.Errorf("error while parsing the query json. %w", err), false) } query = ApplyDefaultsToQuery(ctx, query) if query.PageMode == PaginationModeList && strings.TrimSpace(query.PageParamListFieldName) == "" {