Exception: K8::HttpException

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, message = nil, response_headers = nil) ⇒ HttpException

Returns a new instance of HttpException.



635
636
637
638
639
640
# File 'lib/keight.rb', line 635

def initialize(status_code, message=nil, response_headers=nil)
  response_headers, message = message, nil if message.is_a?(Hash)
  @status_code      = status_code
  @message          = message          if message
  @response_headers = response_headers if response_headers
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



642
643
644
# File 'lib/keight.rb', line 642

def message
  @message
end

#response_headersObject (readonly)

Returns the value of attribute response_headers.



642
643
644
# File 'lib/keight.rb', line 642

def response_headers
  @response_headers
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



642
643
644
# File 'lib/keight.rb', line 642

def status_code
  @status_code
end

Instance Method Details

#status_messageObject



644
645
646
# File 'lib/keight.rb', line 644

def status_message
  return HTTP_RESPONSE_STATUS[@status_code]
end