[v10.4.x] Alerting: Return better error for invalid time range on alert queries (#90372)

Alerting: Return better error for invalid time range on alert queries (#85611)

* Return better error for invalid time range

* drop comment

(cherry picked from commit 03114e7602)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
This commit is contained in:
Fayzal Ghantiwala
2024-07-12 16:15:27 +01:00
committed by GitHub
co-authored by Alexander Weaver
parent 5330f1f23c
commit 466e2573c1
4 changed files with 58 additions and 5 deletions
+4 -4
View File
@@ -496,11 +496,11 @@ func (srv *ProvisioningSrv) RoutePutAlertRuleGroup(c *contextmodel.ReqContext, a
if errors.Is(err, alerting_models.ErrAlertRuleFailedValidation) {
return ErrResp(http.StatusBadRequest, err, "")
}
if errors.Is(err, store.ErrOptimisticLock) {
return ErrResp(http.StatusConflict, err, "")
}
if err != nil {
if errors.Is(err, store.ErrOptimisticLock) {
return ErrResp(http.StatusConflict, err, "")
}
return ErrResp(http.StatusInternalServerError, err, "")
return response.ErrOrFallback(http.StatusInternalServerError, "", err)
}
return response.JSON(http.StatusOK, ag)
}