class MakeTriage::ErrorHandler
Public Instance Methods
error_message(response_text)
click to toggle source
# File lib/make_triage/error_handler.rb, line 7 def error_message(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)
click to toggle source
# File lib/make_triage/error_handler.rb, line 14 def handle_error(error_message, should_abort = true) msg = "ERROR: #{error_message}" if should_abort abort msg else puts msg end end
response_has_error(response)
click to toggle source
# File lib/make_triage/error_handler.rb, line 3 def response_has_error(response) response.code.to_i > 299 end