Method: Sfn::CommandModule::Base::InstanceMethods#_debug

Defined in:
lib/sfn/command_module/base.rb

#_debug(e, *args) ⇒ Object

Write exception information if debug is enabled

Parameters:

  • e (Exception)
  • args (String)

    extra strings to output



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/sfn/command_module/base.rb', line 70

def _debug(e, *args)
  if config[:verbose] || config[:debug]
    ui.fatal "Exception information: #{e.class}: #{e.message}"
    if ENV["DEBUG"] || config[:debug]
      puts "#{e.backtrace.join("\n")}\n"
      if e.is_a?(Miasma::Error::ApiError)
        ui.fatal "Response body: #{e.response.body.to_s.inspect}"
      end
    end
    args.each do |string|
      ui.fatal string
    end
  end
end