Exception: TravelTimeAPI::ServerError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/traveltime_api.rb

Overview

Raised if API server has encountered an error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, http_code) ⇒ ServerError

Returns a new instance of ServerError.



51
52
53
54
# File 'lib/traveltime_api.rb', line 51

def initialize(error, http_code)
  @error = error
  @http_code = http_code
end

Instance Attribute Details

#errorObject (readonly)

Human readable error message.



49
50
51
# File 'lib/traveltime_api.rb', line 49

def error
  @error
end

#http_codeObject (readonly)

Human readable error message.



49
50
51
# File 'lib/traveltime_api.rb', line 49

def http_code
  @http_code
end

Instance Method Details

#to_sObject



56
57
58
# File 'lib/traveltime_api.rb', line 56

def to_s
  "TravelTimeAPI::ServerError[http code: #{@http_code} | #{@error}]"
end