Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use Zalando Problem for all json responses #6404
Overview of the issue
I think it could be useful to choose a unique json format to handle API errors.
The exception handling uses zalando problem through the ExceptionTranslator.
The EntityResource controllers return the error details in the HTTP headers, e.g.
the AccountResource has its own logic, for example for wrong credentials
the Http401UnauthorizedEntryPoint returns the spring json default format
I'm wondering if there is some reason why the exception translator and zalando problem (or the ErrorVM before it) aren't use globally.
Motivation for or Use Case
Most of the APIs we generate with jhipster are exposed to external applications (both web and mobile). We noticed that even documenting these different behaviours it is still quite confusing for those who have to interact with the APIs.
Suggest a Fix
Exceptions could be used in all the generated controllers and in the accountResource, so that all the errors are handled by the ExceptionTranslator.
One thing I have noticed before I forgot. If it can be of any use.
Oh... I know there was 2 things. So, the second thing I noticed is that a
The concerns in zalando/problem-spring-web#86 seem legit.