Module: Charyf::ErrorHandlers

Extended by:
ErrorHandlers
Included in:
ErrorHandlers
Defined in:
lib/charyf/utils/error_handler.rb

Instance Method Summary collapse

Instance Method Details

#<<(handler) ⇒ Object



6
7
8
# File 'lib/charyf/utils/error_handler.rb', line 6

def<<(handler)
  handlers << handler
end

#handle_exception(e) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/charyf/utils/error_handler.rb', line 10

def handle_exception(e)
  Charyf.logger.error "#{e.class}: #{e}".red
  Charyf.logger.error "\n\tBacktrace: #{e.backtrace.join("\n\t")}"

  handlers.map { |h| h.handle_exception(e) }

  e
end