How do we handle server responses on the client side? A simple example is, say for example, a delete
operation has failed on an entity - currently JHipster is returning void
. This may not be ideal in a practical scenario.
I looked at this SO post which describes similar question: REST API error return good practices
Am planning to implement an error DTO and return something like what Twitter does:
{"errors":[{"message":"Sorry, your delete operation failed due to following business constraint...","code":100}]}
The question still remains, how can we make it generic across all API calls i.e., Do we have to add this error DTO to all domain objects?
I personally think having this wired into the basic JHipster framework will be quite helpful instead of reinventing the wheel.