I have a REST operation. User wants to delete an object.
- If a database error occurs
- When writing to response with
response.getWriter()if IOException occurs.
Which status code(500, 503 etc.) should I return to the client side.(I mean which one is more convenient?)
500 sounds most appropriate here, unless you know it’s due to server overload.
If
response.getWriter()(or a later call to the writer) throws anIOException, then I suspect you’re beyond the stage of being able to usefully affect the response received by the client anyway…