【文件属性】:
文件名称:puppet-trycatch
文件大小:3KB
文件格式:ZIP
更新时间:2021-05-04 20:28:01
Ruby
试着抓
这是一个简单的Puppet模块,其中添加了try和catch函数。 它们可以用来捕获在try块中引发的异常。
该模块使用V4函数API,因此您需要使用Puppet 4.x或将来的解析器使用Puppet3.7.x。
例子
$ret = try() || {
assert_type( ' String ' , 1)
notice ( ' This code is never reached ' )
' return value from try '
}.catch | $exception | {
notice ( $exception [ ' class ' ])
notice ( $exception [ ' message ' ])
' return value from catch '
}
notice ( $ret )
输出:
Notice: S
【文件预览】:
puppet-trycatch-master
----README.md(2KB)
----Gemfile(259B)
----lib()
--------puppet()
----Rakefile(614B)
----metadata.json(356B)