# File lib/puppet/util/errors.rb, line 22 22: def exceptwrap(options = {}) 23: options[:type] ||= Puppet::DevError 24: begin 25: return yield 26: rescue Puppet::Error => detail 27: raise adderrorcontext(detail) 28: rescue => detail 29: message = options[:message] || "%s failed with error %s: %s" % 30: [self.class, detail.class, detail.to_s] 31: 32: error = options[:type].new(message) 33: # We can't use self.fail here because it always expects strings, 34: # not exceptions. 35: raise adderrorcontext(error, detail) 36: end 37: 38: return retval 39: end