} catch (final IllegalArgumentException e) {
throw e;
} catch (final InvocationTargetException e) {
final Throwable targetException = e.getTargetException();
if (targetException instanceof IllegalStateException) {
throw new ReflectiveActionException("IllegalStateException thrown while executing " + method + " " + targetException.getMessage(), targetException);
}
if(targetException instanceof RecoverableException) {
if (!runtimeContext.getTransactionState().canCommit()) {
// something severe has happened to the underlying transaction;
// so escalate this exception to be non-recoverable
final Throwable targetExceptionCause = targetException.getCause();
Throwable nonRecoverableCause = targetExceptionCause != null? targetExceptionCause: targetException;
throw new NonRecoverableException(nonRecoverableCause);
}
}
ThrowableExtensions.throwWithinIsisException(e, "Exception executing " + method);
// Action was not invoked (an Exception was thrown)
return InvocationResult.forActionNotInvoked();
} catch (final IllegalAccessException e) {
throw new ReflectiveActionException("Illegal access of " + method, e);
}
}