Class: Hbtrack::ErrorHandler
- Inherits:
-
Object
- Object
- Hbtrack::ErrorHandler
- Defined in:
- lib/hbtrack/error_handler.rb
Class Method Summary collapse
- .raise_error_msg(msg) ⇒ Object
- .raise_habit_name_too_long ⇒ Object
- .raise_habit_not_found(habit_name) ⇒ Object
- .raise_if_habit_error(habit_name) ⇒ Object
- .raise_invalid_arguments ⇒ Object
Class Method Details
.raise_error_msg(msg) ⇒ Object
6 7 8 |
# File 'lib/hbtrack/error_handler.rb', line 6 def raise_error_msg(msg) Util.red msg end |
.raise_habit_name_too_long ⇒ Object
23 24 25 |
# File 'lib/hbtrack/error_handler.rb', line 23 def raise_habit_name_too_long raise_error_msg 'habit_name too long.' end |
.raise_habit_not_found(habit_name) ⇒ Object
15 16 17 |
# File 'lib/hbtrack/error_handler.rb', line 15 def raise_habit_not_found(habit_name) raise_error_msg "Invalid habit: #{habit_name} not found." end |
.raise_if_habit_error(habit_name) ⇒ Object
10 11 12 13 |
# File 'lib/hbtrack/error_handler.rb', line 10 def raise_if_habit_error(habit_name) return raise_invalid_arguments if habit_name.nil? raise_habit_not_found(habit_name) end |
.raise_invalid_arguments ⇒ Object
19 20 21 |
# File 'lib/hbtrack/error_handler.rb', line 19 def raise_invalid_arguments raise_error_msg 'Invalid argument: habit_name is expected.' end |