Skip to content

Commit 3291733

Browse files
authored
Fixes 500 in the frontend when a query is invalid. (#4488)
It should be 400 and was recently introduced by #4464. Signed-off-by: Cyril Tovena <[email protected]>
1 parent 67c0985 commit 3291733

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/querier/queryrange/split_by_interval.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package queryrange
22

33
import (
44
"context"
5+
"net/http"
56
"time"
67

78
"github.com/prometheus/client_golang/prometheus"
89
"github.com/prometheus/client_golang/prometheus/promauto"
910
"github.com/prometheus/prometheus/promql/parser"
11+
"github.com/weaveworks/common/httpgrpc"
1012
)
1113

1214
type IntervalFn func(r Request) time.Duration
@@ -89,7 +91,7 @@ func splitQuery(r Request, interval time.Duration) ([]Request, error) {
8991
func evaluateAtModifierFunction(query string, start, end int64) (string, error) {
9092
expr, err := parser.ParseExpr(query)
9193
if err != nil {
92-
return "", err
94+
return "", httpgrpc.Errorf(http.StatusBadRequest, "%s", err)
9395
}
9496
parser.Inspect(expr, func(n parser.Node, _ []parser.Node) error {
9597
if selector, ok := n.(*parser.VectorSelector); ok {

0 commit comments

Comments
 (0)