QueryService: Return application/json and better errors (#84234)

This commit is contained in:
Ryan McKinley
2024-03-19 15:52:15 +02:00
committed by GitHub
parent d1f791cf1f
commit e27c08cfa9
10 changed files with 293 additions and 92 deletions
+21
View File
@@ -0,0 +1,21 @@
package query_test
import (
"errors"
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/expr"
"github.com/grafana/grafana/pkg/util/errutil"
)
func TestQueryErrorType(t *testing.T) {
qet := expr.QueryError
utilError := errutil.Error{}
qe := expr.MakeQueryError("A", "", fmt.Errorf("not work"))
require.True(t, errors.Is(qe, qet))
require.True(t, errors.As(qe, &utilError))
}