Skip to content

Commit 9825137

Browse files
authored
fix(retry): do not retry if any of multierrors is a client error (#19887)
1 parent 4d504f0 commit 9825137

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/util/server/error.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ func ClientHTTPStatusAndError(err error) (int, error) {
7272
return http.StatusGatewayTimeout, errors.New(ErrDeadlineExceeded)
7373
}
7474

75+
// Return 400 if any of the errors in the MultiError are client errors (4xx)
76+
if ok {
77+
for _, e := range me {
78+
if errors.As(e, &queryErr) ||
79+
errors.Is(e, logqlmodel.ErrLimit) ||
80+
errors.Is(e, logqlmodel.ErrParse) ||
81+
errors.Is(e, logqlmodel.ErrPipeline) ||
82+
errors.Is(e, logqlmodel.ErrBlocked) ||
83+
errors.Is(e, logqlmodel.ErrParseMatchers) ||
84+
errors.Is(e, logqlmodel.ErrUnsupportedSyntaxForInstantQuery) ||
85+
errors.Is(e, user.ErrNoOrgID) ||
86+
errors.As(e, &userErr) ||
87+
errors.Is(e, logqlmodel.ErrVariantsDisabled) {
88+
return http.StatusBadRequest, err
89+
}
90+
}
91+
}
92+
7593
if s, isRPC := status.FromError(err); isRPC {
7694
if s.Code() == codes.DeadlineExceeded {
7795
return http.StatusGatewayTimeout, errors.New(ErrDeadlineExceeded)

0 commit comments

Comments
 (0)