log.debug("Invoking {}", Stringnifier.simpleNameFor(reflectionMethod));
Object result = reflectionMethod.invoke(resourceInstance, parameters);
if (validator.hasErrors()) { // method should have thrown
// ValidationError
throw new InterceptionException(
"There are validation errors and you forgot to specify where to go. Please add in your method "
+ "something like:\n"
+ "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n"
+ "or any view that you like.\n"
+ "If you didn't add any validation error, it is possible that a conversion error had happened.");
}
if (reflectionMethod.getReturnType().equals(Void.TYPE)) {
// vraptor2 compatibility
this.info.setResult("ok");
} else {
this.info.setResult(result);
}
stack.next(method, resourceInstance);
} catch (IllegalArgumentException e) {
throw new InterceptionException(e);
} catch (IllegalAccessException e) {
throw new InterceptionException(e);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof ValidationException) {
// fine... already parsed
log.trace("swallowing {}", cause);
} else {
throw new InterceptionException("exception raised, check root cause for details: " + cause, cause);
}
}
}