Sha256: 8a544d16fca4886104e2409a086a63f90dcb42ac679982113eb0b7cd008c3de4

Contents?: true

Size: 487 Bytes

Versions: 4

Compression:

Stored size: 487 Bytes

Contents

module IssueExporting
  class ErrorHandler
    def response_has_error(response)
      response.code.to_i > 299
    end

    def error_message(response_text)
      response_object = JSON.parse response_text
      if response_object.is_a? Hash
        response_object["message"]
      end
    end

    def handle_error(error_message, should_abort = true)
      msg = "ERROR: #{error_message}"
      if should_abort
        abort msg
      else
        puts msg
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_issue_exporter-0.3.1 lib/issue_exporter/error_handler.rb
github_issue_exporter-0.3.0 lib/issue_exporter/error_handler.rb
github_issue_exporter-0.2.1 lib/issue_exporter/error_handler.rb
github_issue_exporter-0.2.0 lib/issue_exporter/error_handler.rb