java - JHipster: Managing server response on client -


how handle server responses on client side? simple example is, example, delete operation has failed on entity - jhipster returning void. may not ideal in practical scenario.

i looked @ post describes similar question: rest api error return practices

am planning implement error dto , return twitter does:

{"errors":[{"message":"sorry, delete operation failed due following business constraint...","code":100}]} 

the question still remains, how can make generic across api calls i.e., have add error dto domain objects?

i think having wired basic jhipster framework quite helpful instead of reinventing wheel.

the fact jhipster's rest controller returns void delete method not mean cannot send information client, if wrong exception thrown underlying service or repository. exception translated exceptiontranslator controlleradvice adequate http error status.

if want, it's code own exception resolver in controller , return want.

i'm not sure returning status error 200 (ok) when delete failed able pass message best approach. error not 200, @ least not http.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -