Skip to content

Commit

Permalink
Fix error source for invalid queries (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanahuckova authored Nov 20, 2024
1 parent 44b48c2 commit d44d3bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-panthers-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'grafana-infinity-datasource': patch
---

Fix error source for invalid queries
3 changes: 1 addition & 2 deletions pkg/models/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) == "" {
Expand Down

0 comments on commit d44d3bd

Please sign in to comment.