Skip to content

Commit 4b54dbb

Browse files
authored
fix: mark incorrect marcos arguments error as downstream (#140)
1 parent dd67922 commit 4b54dbb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

datasource.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func (ds *SQLDatasource) handleQuery(ctx context.Context, req backend.DataQuery,
153153
// Apply supported macros to the query
154154
q.RawSQL, err = Interpolate(ds.driver(), q)
155155
if err != nil {
156+
if errors.Is(err, sqlutil.ErrorBadArgumentCount) {
157+
err = backend.DownstreamError(err)
158+
}
156159
return sqlutil.ErrorFrameFromQuery(q), fmt.Errorf("%s: %w", "Could not apply macros", err)
157160
}
158161

errors.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ func DownstreamError(err error, override ...bool) error {
2929
}
3030

3131
func ErrorSource(err error) backend.ErrorSource {
32-
var se es.Error
33-
if errors.As(err, &se) {
34-
return se.Source()
32+
if backend.IsDownstreamError(err) {
33+
return backend.ErrorSourceDownstream
3534
}
3635
return backend.ErrorSourcePlugin
3736
}

0 commit comments

Comments
 (0)