public static void throwWithinIsisException(final InvocationTargetException e, final String error) {
final Throwable targetException = e.getTargetException();
if (targetException instanceof RecoverableException) {
// an application exception from the domain code is re-thrown as an
// IsisException with same semantics
throw new IsisApplicationException(targetException);
}
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
} else {
throw new MetaModelException(targetException);