# encoding: utf-8 result = $exceptions.tryCatch { |exceptionCatcher| exceptionCatcher.tryRunning { $console.log("tryRunning执行了1") $exceptions.throwException { |eb| eb.setMessage("xxx") } $console.log("不会执行到这里") "没有异常" } exceptionCatcher.catchException { |it| $console.log("catchException执行了") "出现异常" + it.getMessage() } exceptionCatcher.finallyRun { $console.log("finally run 1...") } } $console.log("result", result) result = $exceptions.tryCatch { |exceptionCatcher| exceptionCatcher.tryRunning { $console.log("tryRunning执行了2") "没有异常" } exceptionCatcher.catchException { |it| $console.log("不会执行到这里") "出现异常" + it.getMessage() } exceptionCatcher.finallyRun { $console.log("finally run 2...") } } $console.log("result", result)