Module: Achoo::UI::ExceptionHandling
- Included in:
- Achoo, RegisterHours
- Defined in:
- lib/achoo/ui/exception_handling.rb
Instance Method Summary collapse
- #get_exception_reason(e) ⇒ Object
- #handle_exception(user_message, e) ⇒ Object
- #handle_fatal_exception(user_message, e) ⇒ Object
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) "\nReason: \n\t" + e..gsub("\n", "\n\t") + "\n---\n\t" + e.backtrace.join("\n\t") end |
#handle_exception(user_message, e) ⇒ Object
7 8 9 |
# File 'lib/achoo/ui/exception_handling.rb', line 7 def handle_exception(, e) Achoo::Term::warn() + get_exception_reason(e) end |
#handle_fatal_exception(user_message, e) ⇒ Object
11 12 13 14 |
# File 'lib/achoo/ui/exception_handling.rb', line 11 def handle_fatal_exception(, e) puts Achoo::Term::fatal() + get_exception_reason(e) exit 1 end |