Exception: RightScale::HttpException

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

Overview

Base HTTP exception class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, body, response = nil) ⇒ HttpException

Returns a new instance of HttpException.



22
23
24
25
26
# File 'lib/right_agent/http_exceptions.rb', line 22

def initialize(code, body, response = nil)
  @http_code = code
  @http_body = body
  @response = response
end

Instance Attribute Details

#http_bodyObject (readonly)

Returns the value of attribute http_body.



19
20
21
# File 'lib/right_agent/http_exceptions.rb', line 19

def http_body
  @http_body
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



19
20
21
# File 'lib/right_agent/http_exceptions.rb', line 19

def http_code
  @http_code
end

#messageObject



36
37
38
# File 'lib/right_agent/http_exceptions.rb', line 36

def message
  @message || self.class.name
end

#responseObject

Returns the value of attribute response.



20
21
22
# File 'lib/right_agent/http_exceptions.rb', line 20

def response
  @response
end

Instance Method Details

#inspectObject



28
29
30
# File 'lib/right_agent/http_exceptions.rb', line 28

def inspect
  "#{message}: #{http_body}"
end

#to_sObject



32
33
34
# File 'lib/right_agent/http_exceptions.rb', line 32

def to_s
  inspect
end