Exception: Litmus::Infrastructure::ServerException
- Inherits:
-
GenericError
- Object
- StandardError
- GenericError
- Litmus::Infrastructure::ServerException
- Defined in:
- lib/litmus/infrastructure/exceptions.rb
Overview
Raised when a 500 response code has been received.
Attributes
-
response
- The Response from the Litmus Infrastructure API
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response, params = nil) ⇒ ServerException
constructor
:nodoc:.
Methods included from Base
Constructor Details
#initialize(response, params = nil) ⇒ ServerException
:nodoc:
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/litmus/infrastructure/exceptions.rb', line 43 def initialize(response, params = nil) #:nodoc: @response = response status = response.status headers = response.http_header req_method = headers.request_method req_uri = headers.request_uri error = headers.reason_phrase = "#{req_method} #{req_uri} failed with #{status} (#{error})" += "\n\nResponse: #{response.body}" += "\n\nRequest body: #{params.to_json}" if params.is_a?(Hash) super end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
41 42 43 |
# File 'lib/litmus/infrastructure/exceptions.rb', line 41 def response @response end |