Server-side expressions: Improve error message (#103968)

This error message is more correct
pull/104017/head
Sam Jewell 2 months ago committed by GitHub
parent 0283c98e30
commit 4aa7d67edd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/expr/errors.go
  2. 4
      pkg/registry/apis/query/errors.go
  3. 4
      pkg/tests/apis/query/query_test.go

@ -58,7 +58,7 @@ func MakeQueryError(refID, datasourceUID string, err error) error {
return QueryError.Build(data)
}
var depErrStr = "did not execute expression [{{ .Public.refId }}] due to a failure to of the dependent expression or query [{{.Public.depRefId}}]"
var depErrStr = "did not execute expression [{{ .Public.refId }}] due to a failure of the dependent expression or query [{{.Public.depRefId}}]"
var DependencyError = errutil.NewBase(
errutil.StatusBadRequest, "sse.dependencyError").MustTemplate(
@ -71,7 +71,7 @@ func MakeDependencyError(refID, depRefID string) error {
"refId": refID,
"depRefId": depRefID,
},
Error: fmt.Errorf("did not execute expression %v due to a failure to of the dependent expression or query %v", refID, depRefID),
Error: fmt.Errorf("did not execute expression %v due to a failure of the dependent expression or query %v", refID, depRefID),
}
return DependencyError.Build(data)

@ -44,7 +44,7 @@ func MakePublicQueryError(refID, err string) error {
return QueryError.Build(data)
}
var depErrStr = "did not execute expression [{{ .Public.refId }}] due to a failure to of the dependent expression or query [{{.Public.depRefId}}]"
var depErrStr = "did not execute expression [{{ .Public.refId }}] due to a failure of the dependent expression or query [{{.Public.depRefId}}]"
var dependencyError = errutil.BadRequest("sse.dependencyError").MustTemplate(
depErrStr,
@ -56,7 +56,7 @@ func makeDependencyError(refID, depRefID string) error {
"refId": refID,
"depRefId": depRefID,
},
Error: fmt.Errorf("did not execute expression %v due to a failure to of the dependent expression or query %v", refID, depRefID),
Error: fmt.Errorf("did not execute expression %v due to a failure of the dependent expression or query %v", refID, depRefID),
}
return dependencyError.Build(data)

@ -140,7 +140,7 @@ func TestIntegrationSimpleQuery(t *testing.T) {
require.JSONEq(t, `{
"results": {
"A": {
"error": "[sse.dependencyError] did not execute expression [Y] due to a failure to of the dependent expression or query [X]",
"error": "[sse.dependencyError] did not execute expression [Y] due to a failure of the dependent expression or query [X]",
"status": 400,
"errorSource": ""
}
@ -149,7 +149,7 @@ func TestIntegrationSimpleQuery(t *testing.T) {
// require.JSONEq(t, `{
// "status": "Failure",
// "metadata": {},
// "message": "did not execute expression [Y] due to a failure to of the dependent expression or query [X]",
// "message": "did not execute expression [Y] due to a failure of the dependent expression or query [X]",
// "reason": "BadRequest",
// "details": { "group": "query.grafana.app" },
// "code": 400,

Loading…
Cancel
Save