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

* Return better error for invalid time range

* drop comment
This commit is contained in:
Alexander Weaver
2024-04-05 09:20:21 -05:00
committed by GitHub
parent 9af259a0d6
commit 03114e7602
4 changed files with 57 additions and 5 deletions

View File

@@ -488,10 +488,10 @@ 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 response.ErrOrFallback(http.StatusInternalServerError, "", err)
}
return response.JSON(http.StatusOK, ag)