Exception: Ronan::HttpError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ronan/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HttpError

Returns a new instance of HttpError.



9
10
11
12
# File 'lib/ronan/error.rb', line 9

def initialize(response)
  super(response.message)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/ronan/error.rb', line 7

def response
  @response
end

Instance Method Details

#codeObject



22
23
24
# File 'lib/ronan/error.rb', line 22

def code
  response.code
end

#contextObject



18
19
20
# File 'lib/ronan/error.rb', line 18

def context
  "#{response.uri} responded with #{response.code}"
end

#messageObject



14
15
16
# File 'lib/ronan/error.rb', line 14

def message
  "#{response.message} (#{context})"
end

#to_sObject



26
27
28
# File 'lib/ronan/error.rb', line 26

def to_s
  message
end