当我删除一个对象时,抛出哪个异常最有意义,该对象依赖于另一个对象(jpa)。我应该返回哪个状态代码,我刚刚看到 424 可以适合,但 wiki 描述不支持这个理论:
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.
您还可以在正文中添加消息,解释冲突存在的原因。
关于java - 删除依赖对象的异常处理(jpa/rest-service),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31986642/