Method: ChefApply::UI::ErrorPrinter#initialize
- Defined in:
- lib/chef_apply/ui/error_printer.rb
#initialize(wrapper, unwrapped = nil, target_host = nil) ⇒ ErrorPrinter
Returns a new instance of ErrorPrinter.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/chef_apply/ui/error_printer.rb', line 92 def initialize(wrapper, unwrapped = nil, target_host = nil) @exception = unwrapped || wrapper.contained_exception @target_host = wrapper.target_host || target_host @command = exception.respond_to?(:command) ? exception.command : nil @pastel = Pastel.new @content = StringIO.new @id = if exception.is_a? ChefApply::Error exception.id else DEFAULT_ERROR_NO end @translation = ChefApply::Text::ErrorTranslation.new(id) rescue => e ErrorPrinter.dump_unexpected_error(e) exit! 128 end |