删除依赖对象的异常处理 (jpa/rest-service)

exception handling for deleting dependent objects (jpa/rest-service)

当我删除一个依赖于另一个对象 (jpa) 的对象时,抛出哪个异常最有意义。我应该使用哪个状态码 return,我刚看到 424 可以,但是维基描述不支持这个理论:

424 Failed Dependency (WebDAV; RFC 4918)

The request failed due to failure of a previous request (e.g., a PROPPATCH).[4]

您可以使用:

409 - Conflict.

The request could not be completed due to a conflict with the current state of the resource.

您也可以在正文中添加解释冲突原因的消息。