Exception: ChefAPI::Error::ChefAPIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/chef-api/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ChefAPIError

Returns a new instance of ChefAPIError.



18
19
20
21
22
23
# File 'lib/chef-api/errors.rb', line 18

def initialize(options = {})
  @options  = options
  @filename = options.delete(:_template)

  super()
end

Instance Method Details

#messageObject Also known as: to_s



25
26
27
28
# File 'lib/chef-api/errors.rb', line 25

def message
  erb = ERB.new(File.read(template))
  erb.result(ErrorBinding.new(@options).get_binding)
end