[英]org.rythmengine.exception.CompileException: Unhandled exception type Exception
當通過http://fiddle.rythmengine.com/#/editor上的Rythm引擎小提琴嘗試以下rythm模板代碼時
我得到錯誤:
org.rythmengine.exception.CompileException: Unhandled exception type Exception
我嘗試的模板是:
@{
class Field {
String description;
String getDescription() throws Exception {
return description;
}
}
Field field=new Field();
field.description="test";
}
the field description is: @(field.getDescription())
我翻閱了有關try / catch結構的文檔,並咨詢了我最喜歡的搜索引擎。 我沒有找到有關如何處理異常的提示。
如何在Rythm模板代碼中處理異常?
您需要確保不拋出檢查異常。 將您的代碼更改為:
@{
class Field {
String description;
String getDescription() throws RuntimeException {
return description;
}
}
Field field=new Field();
field.description="test";
}
the field description is: @(field.getDescription())
它應該工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.