Exception: Chef::Exceptions::RunFailedWrappingError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Chef::Exceptions::RunFailedWrappingError
- Defined in:
- lib/chef/exceptions.rb
Overview
If a converge fails, we want to wrap the output from those errors into 1 error so we can see both issues in the output. It is possible that nil will be provided. You must call ‘fill_backtrace` to correctly populate the backtrace with the wrapped backtraces.
Instance Attribute Summary collapse
-
#wrapped_errors ⇒ Object
readonly
Returns the value of attribute wrapped_errors.
Instance Method Summary collapse
- #fill_backtrace ⇒ Object
-
#initialize(*errors) ⇒ RunFailedWrappingError
constructor
A new instance of RunFailedWrappingError.
Constructor Details
#initialize(*errors) ⇒ RunFailedWrappingError
Returns a new instance of RunFailedWrappingError.
451 452 453 454 455 456 |
# File 'lib/chef/exceptions.rb', line 451 def initialize(*errors) errors = errors.select { |e| !e.nil? } output = "Found #{errors.size} errors, they are stored in the backtrace" @wrapped_errors = errors super output end |
Instance Attribute Details
#wrapped_errors ⇒ Object (readonly)
Returns the value of attribute wrapped_errors.
450 451 452 |
# File 'lib/chef/exceptions.rb', line 450 def wrapped_errors @wrapped_errors end |
Instance Method Details
#fill_backtrace ⇒ Object
458 459 460 461 462 463 464 465 466 |
# File 'lib/chef/exceptions.rb', line 458 def fill_backtrace backtrace = [] wrapped_errors.each_with_index do |e, i| backtrace << "#{i + 1}) #{e.class} - #{e.}" backtrace += e.backtrace if e.backtrace backtrace << "" unless i == wrapped_errors.length - 1 end set_backtrace(backtrace) end |