code: protected Response handleValidationException(Throwable exception, Throwable catched) {
  
      Throwable t = catched;
      Map<String, List<String>> errorsMap = null;
      if (exception instanceof ConstraintViolationException) {
        ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
        Set<ConstraintViolation<?>> violations = constraintViolationException.getConstraintViolations();
        errorsMap = new HashMap<>();
  
        for (ConstraintViolation<?> violation : violations) {
          Iterator<Node> it = violation.getPropertyPath().iterator();
          String fieldName = null;
  
          // Getting fieldname from the exception
          while (it.hasNext()) {
            fieldName = it.next().toString();
          }
  
          List<String> errorsList = errorsMap.get(fieldName);
  
          if (errorsList == null) {
            errorsList = new ArrayList<>();
            errorsMap.put(fieldName, errorsList);
          }
  
          errorsList.add(violation.getMessage());
  
        }
  
        t = new ValidationException(errorsMap.toString(), catched);
      }
      ValidationErrorUserException error = new ValidationErrorUserException(t);
      return createResponse(t, error, errorsMap);
    }
docs: Exception handling for validation exception.
  
  @param exception the exception to handle
  @param catched the original exception that was cached. Either same as {@code error} or a (child-)
  {@link Throwable#getCause() cause} of it.
  @return the response build from the exception.