Exception: Protip::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
15
16
17
# File 'lib/protip/error.rb', line 8

def initialize(request, response)
  @request = request
  @response = response

  msg = <<-MSG
Received HTTP #{response.code} from #{request.uri}. Response:
#{response.body}
  MSG
  super(msg)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#inspectObject



19
20
21
# File 'lib/protip/error.rb', line 19

def inspect
  "[#{self.class}] #{request.uri} -> code #{response.code}"
end