1
腳本執行的詳細信息,我發現here的我想要的一個很好的例子:如何獲取關於在常規
基本上就能夠執行字符串作爲與Groovy腳本表達式,但如果條件爲假,我想顯示爲什麼評估爲false的詳細信息。
編輯
我想要的工作,像這樣的實用方法:
def expression = "model.book.title == \"The Shining\""
def output = magicMethod(expression)
// output.result: the exact result of executing expression
// output.detail: could be a string telling me why this expression returns true or false, similar to de image
我認爲這可能是Eval.me
+ assert
組合和捕獲異常,以獲取詳細信息
所以你想要'assert'關鍵字產生的消息,但不能只使用'assert'? –