diff --git a/lib/go/framesql/CHANGELOG.md b/lib/go/framesql/CHANGELOG.md index a112257..b84a5ea 100644 --- a/lib/go/framesql/CHANGELOG.md +++ b/lib/go/framesql/CHANGELOG.md @@ -1,5 +1,9 @@ # @grafana/infinity-framesql +## 1.0.2 + +- ⚙️ **Chore**: improved error messages + ## 1.0.1 - ⚙️ **Chore**: improved error messages diff --git a/lib/go/framesql/errors.go b/lib/go/framesql/errors.go index 4c43321..122763c 100644 --- a/lib/go/framesql/errors.go +++ b/lib/go/framesql/errors.go @@ -4,4 +4,5 @@ import "errors" var ( ErrEmptySummarizeExpression = errors.New("empty/invalid summarize expression") + ErrExpressionNotFoundInFields = errors.New("expression not found in fields") ) diff --git a/lib/go/framesql/frame.go b/lib/go/framesql/frame.go index 7cbe8e2..0fb979b 100644 --- a/lib/go/framesql/frame.go +++ b/lib/go/framesql/frame.go @@ -26,6 +26,11 @@ func EvaluateInFrame(expression string, input *data.Frame) (any, error) { } } result, err := parsedExpression.Evaluate(parameters) + if err != nil { + if checkIfExpressionFoundInFields(err) { + return result, errors.Join(err, ErrExpressionNotFoundInFields) + } + } return result, err } @@ -206,3 +211,10 @@ func toFloat64p(input any) (*float64, bool) { } return nil, false } + +func checkIfExpressionFoundInFields(err error) bool { + r := regexp.MustCompile(`No parameter '(.+)' found\.`) + // Check if the message matches the pattern + matches := r.FindStringSubmatch(err.Error()) + return len(matches) > 0 +} \ No newline at end of file diff --git a/lib/go/framesql/package.json b/lib/go/framesql/package.json index c246640..a388135 100644 --- a/lib/go/framesql/package.json +++ b/lib/go/framesql/package.json @@ -1,7 +1,7 @@ { "name": "@grafana/infinity-framesql", "private": true, - "version": "1.0.1", + "version": "1.0.2", "scripts": { "tidy": "go mod tidy", "test:backend": "go test -v ./..." diff --git a/lib/go/transformations/CHANGELOG.md b/lib/go/transformations/CHANGELOG.md index d66cbe0..188d064 100644 --- a/lib/go/transformations/CHANGELOG.md +++ b/lib/go/transformations/CHANGELOG.md @@ -1,5 +1,9 @@ # @grafana/infinity-transformations +## 1.0.2 + +- ⚙️ **Chore**: improved error messages + ## 1.0.1 - ⚙️ **Chore**: improved error messages diff --git a/lib/go/transformations/errors.go b/lib/go/transformations/errors.go index bf530a2..11667c7 100644 --- a/lib/go/transformations/errors.go +++ b/lib/go/transformations/errors.go @@ -6,6 +6,7 @@ var ( ErrSummarizeByFieldNotFound = errors.New("summarize by field not found. Not applying summarize") ErrNotUniqueFieldNames = errors.New("field names are not unique. Not applying filter") ErrEvaluatingFilterExpression = errors.New("error evaluating filter expression") + ErrInvalidToken = errors.New("invalid token") ErrMergeTransformationNoFrameSupplied = errors.New("no frames supplied for merge frame transformation") ErrMergeTransformationDifferentFields = errors.New("unable to merge fields due to different fields") diff --git a/lib/go/transformations/package.json b/lib/go/transformations/package.json index 695cc16..0ee007f 100644 --- a/lib/go/transformations/package.json +++ b/lib/go/transformations/package.json @@ -1,7 +1,7 @@ { "name": "@grafana/infinity-transformations", "private": true, - "version": "1.0.1", + "version": "1.0.2", "scripts": { "tidy": "go mod tidy", "test:backend": "go test -v ./..."