Skip to content

Commit 0f7924c

Browse files
authored
Improve error handling for invalid queries (#65)
1 parent da7d69c commit 0f7924c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

datasource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (ds *sqldatasource) handleQuery(ctx context.Context, req backend.DataQuery,
170170
// Convert the backend.DataQuery into a Query object
171171
q, err := GetQuery(req)
172172
if err != nil {
173-
return getErrorFrameFromQuery(q), err
173+
return nil, err
174174
}
175175

176176
// Apply supported macros to the query

query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func GetQuery(query backend.DataQuery) (*Query, error) {
6767
model := &Query{}
6868

6969
if err := json.Unmarshal(query.JSON, &model); err != nil {
70-
return nil, ErrorJSON
70+
return nil, fmt.Errorf("%w: %v", ErrorJSON, err)
7171
}
7272

7373
// Copy directly from the well typed query

0 commit comments

Comments
 (0)