Class: IssueExporting::ErrorHandler
- Inherits:
-
Object
- Object
- IssueExporting::ErrorHandler
- Defined in:
- lib/issue_exporter/error_handler.rb
Instance Method Summary collapse
- #error_message(response_text) ⇒ Object
- #handle_error(error_message, should_abort = true) ⇒ Object
- #response_has_error(response) ⇒ Object
Instance Method Details
#error_message(response_text) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/issue_exporter/error_handler.rb', line 7 def (response_text) response_object = JSON.parse response_text if response_object.is_a? Hash response_object["message"] end end |
#handle_error(error_message, should_abort = true) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/issue_exporter/error_handler.rb', line 14 def handle_error(, should_abort = true) msg = "ERROR: #{error_message}" if should_abort abort msg else puts msg end end |
#response_has_error(response) ⇒ Object
3 4 5 |
# File 'lib/issue_exporter/error_handler.rb', line 3 def response_has_error(response) response.code.to_i > 299 end |