Method: Sym::App.error

Defined in:
lib/sym/app.rb

.error(config: {}, exception: nil, type: nil, details: nil, reason: nil, comments: nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sym/app.rb', line 28

def self.error(
  config: {},
  exception: nil,
  type: nil,
  details: nil,
  reason: nil,
  comments: nil)

  self.out.puts([\
                "#{(type || exception.class.name).titleize}:".red.bold.underlined +
                (sprintf '  %s', details || exception.message).red.italic,
                (reason ? "\n#{reason.blue.bold.italic}" : nil),
                (comments ? "\n\n#{comments}" : nil)].compact.join("\n"))
  self.out.puts "\n" + exception.backtrace.join("\n").bold.red if exception && config && config[:trace]
  self.exit_code = 1
end