I have exception anotated with @ResponseStatus like this:
@ResponseStatus(value = HttpStatus.UNPROCESSABLE_ENTITY, reason = "Restrioctions violated. Need confirmation.")
@ResponseBody
public class RestrictionExceptions extends Exception {
private List<RestrictionViolation> restrictionViolations;
But when exception is raised there is only HTTP status code and reason from @ResponseStatus declaration. Is it possible to include also restrictionViolations in error response body?
I want to keep exception declaration in exception itself, I don't want to introduce some exception handling method in controller if it's possible.