When trying out the rythm template code below via the Rythm engine fiddle at http://fiddle.rythmengine.com/#/editor
I get the error:
org.rythmengine.exception.CompileException: Unhandled exception type Exception
the template I tried is:
@{
class Field {
String description;
String getDescription() throws Exception {
return description;
}
}
Field field=new Field();
field.description="test";
}
the field description is: @(field.getDescription())
I have looked thru the documentation for some kind of try/catch construct and consulted my favorite search engine. I didn't find a hint on how to handle exceptions.
How are exceptions to be handled in Rythm template code?
You need to make sure you do NOT throw out checked exception. Change your code to :
And it should work