return field.get(scope);
} else {
return method.invoke(scope, arguments);
}
} catch (IllegalArgumentException e) {
throw new MustacheException("Wrong method for object: " + method + " on " + scope, e);
} catch (InvocationTargetException e) {
throw new MustacheException("Failed to execute method: " + method, e.getTargetException());
} catch (IllegalAccessException e) {
throw new MustacheException("Failed to execute method: " + method, e);
}
}