Exception: Protip::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Protip::Error
- Defined in:
- lib/protip/error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ Error
constructor
A new instance of Error.
- #inspect ⇒ Object
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
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'lib/protip/error.rb', line 7 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/protip/error.rb', line 7 def response @response end |
Instance Method Details
#inspect ⇒ Object
19 20 21 |
# File 'lib/protip/error.rb', line 19 def inspect "[#{self.class}] #{request.uri} -> code #{response.code}" end |