[v10.4.x] Alerting: Return a 400 and errutil error when trying to delete a contact point that is referenced by a policy (#86162)

Alerting: Return a 400 and errutil error when trying to delete a contact point that is referenced by a policy (#85481)

Return a 400 and errutil error when trying to delete a contact point that is referenced by a policy

(cherry picked from commit 5b1498f98f)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-15 09:49:15 -05:00
committed by GitHub
co-authored by Alexander Weaver
parent 2530844825
commit 2c66783f98
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ func (srv *ProvisioningSrv) RoutePutContactPoint(c *contextmodel.ReqContext, cp
func (srv *ProvisioningSrv) RouteDeleteContactPoint(c *contextmodel.ReqContext, UID string) response.Response {
err := srv.contactPointService.DeleteContactPoint(c.Req.Context(), c.SignedInUser.GetOrgID(), UID)
if err != nil {
return ErrResp(http.StatusInternalServerError, err, "")
return response.ErrOrFallback(http.StatusInternalServerError, "failed to delete contact point", err)
}
return response.JSON(http.StatusAccepted, util.DynMap{"message": "contactpoint deleted"})
}