return 412 when deleting a target used by a policy, fix #1881

This commit is contained in:
Wenkai Yin 2017-03-30 18:59:18 +08:00
parent 2092387e18
commit f0f305a69c

View File

@ -328,7 +328,7 @@ func (t *TargetAPI) Delete() {
}
if len(policies) > 0 {
t.CustomAbort(http.StatusBadRequest, "the target is used by policies, can not be deleted")
t.CustomAbort(http.StatusPreconditionFailed, "the target is used by policies, can not be deleted")
}
if err = dao.DeleteRepTarget(id); err != nil {