SSE: Return error messages instead of 500 on SSE command parse errors (#109480)

fixes #108897

---------

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
Ihor Yeromin
2025-09-02 18:00:14 +00:00
committed by GitHub
co-authored by Kyle Brandt
parent 76af73b3f3
commit bdf9583ada
4 changed files with 40 additions and 2 deletions
+19
View File
@@ -148,6 +148,25 @@ func TestDSQueryError(t *testing.T) {
require.Equal(t, fp(42), res.Responses["C"].Frames[0].Fields[0].At(0))
}
func TestParseError(t *testing.T) {
resp := map[string]backend.DataResponse{}
queries := []Query{
{
RefID: "A",
DataSource: dataSourceModel(),
JSON: json.RawMessage(`{ "datasource": { "uid": "__expr__", "type": "__expr__"}, "type": "math", "expression": "asdf" }`),
},
}
s, req := newMockQueryService(resp, queries)
_, err := s.BuildPipeline(t.Context(), req)
require.ErrorContains(t, err, "parse")
require.ErrorContains(t, err, "math")
require.ErrorContains(t, err, "asdf")
}
func TestSQLExpressionCellLimitFromConfig(t *testing.T) {
tests := []struct {
name string