try {
GroovyUtils.callWithDelegate(block, delegate);
} catch (GroovyRuntimeException e) {
// this quite possibly wraps an exception we want to throw
if (e.getClass().equals(GroovyRuntimeException.class) && e.getCause() != null) {
throw new RecommenderConfigurationException("Error evaluating Groovy block",
e.getCause());
} else {
throw new RecommenderConfigurationException("Error evaluating Groovy block", e);
}
} catch (RuntimeException e) {
throw new RecommenderConfigurationException("Error evaluating Groovy block", e);
}
}