# File lib/puppet/util/errors.rb, line 32
32:   def exceptwrap(options = {})
33:     options[:type] ||= Puppet::DevError
34:     begin
35:       return yield
36:     rescue Puppet::Error => detail
37:       raise adderrorcontext(detail)
38:     rescue => detail
39:       message = options[:message] || "#{self.class} failed with error #{detail.class}: #{detail}"
40: 
41:       error = options[:type].new(message)
42:       # We can't use self.fail here because it always expects strings,
43:       # not exceptions.
44:       raise adderrorcontext(error, detail)
45:     end
46: 
47:     retval
48:   end