Method: Logcamp.handle_connection_error

Defined in:
lib/logcamp.rb

.handle_connection_error(e) ⇒ Object

Raises:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/logcamp.rb', line 92

def self.handle_connection_error(e)
  case e
    when SocketError
      message = "Unexpected error when trying to connect to Logcamp."

    when NoMethodError
      message = "Unexpected HTTP response code"
    when InvalidMetadataError
      message = "Invalid metadata. Only key value pair is supported"
    else
      message = "Unexpected error communicating with Logcamp."
  end

  raise APIConnectionError.new(message + "\n\n(Network error: #{e.message})")
end