Exception: HttpClient::ExceptionWithResponse

Inherits:
Exception
  • Object
show all
Defined in:
lib/http_client/exceptions.rb

Overview

Base HttpClient exception when there’s a response available

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Exception

#message

Constructor Details

#initialize(response = nil) ⇒ ExceptionWithResponse

Returns a new instance of ExceptionWithResponse.



14
15
16
# File 'lib/http_client/exceptions.rb', line 14

def initialize(response=nil)
  @response = response
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



12
13
14
# File 'lib/http_client/exceptions.rb', line 12

def response
  @response
end

Instance Method Details

#http_codeObject



18
19
20
# File 'lib/http_client/exceptions.rb', line 18

def http_code
  @response.code.to_i if @response
end