Module: Achoo::UI::ExceptionHandling

Included in:
App, ICal, Plugin::Awake, Plugin::Ical, Plugin::VCS, RegisterHours
Defined in:
lib/achoo/ui/exception_handling.rb

Instance Method Summary collapse

Instance Method Details

#get_exception_reason(e) ⇒ Object



16
17
18
# File 'lib/achoo/ui/exception_handling.rb', line 16

def get_exception_reason(e)
  "\nType:\t" + e.class.to_s +  "\nReason: \n\t" + e.message.gsub("\n", "\n\t") + "\n---\n\t" + e.backtrace.join("\n\t")
end

#handle_exception(user_message, e) ⇒ Object



8
9
10
# File 'lib/achoo/ui/exception_handling.rb', line 8

def handle_exception(user_message, e)
  Term::warn(user_message) + get_exception_reason(e)
end

#handle_fatal_exception(user_message, e) ⇒ Object



12
13
14
# File 'lib/achoo/ui/exception_handling.rb', line 12

def handle_fatal_exception(user_message, e)
  abort Term::fatal(user_message) + get_exception_reason(e)
end