Puppet Function: try
- Defined in:
- lib/puppet/functions/try.rb
- Function type:
- Ruby 4.x API
Overview
Call a lambda and rescue exceptions from it.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppet/functions/try.rb', line 12 Puppet::Functions.create_function(:try) do dispatch :try do block_param end def try [yield, nil] rescue [nil, { 'class' => $!.class.to_s, 'message' => $!., 'exception' => $! }] end end |