class T2Server::UnexpectedServerResponse

Raised when there is an unexpected response from the server. This does not necessarily indicate a problem with the server.

Attributes

body[R]

The response body of this error. If the server did not supply one then this will be “<none>”.

code[R]

The HTTP error code of this error.

method[R]

The method that was called to produce this error.

path[R]

The path of the URI that returned this error.

Public Class Methods

new(method, path, response) click to toggle source

Create a new UnexpectedServerResponse with details of which HTTP method was called, the path that it was called on and the specified unexpected response. The response to be passed in is that which was returned by a call to Net::HTTP#request.

Calls superclass method
# File lib/t2-server/exceptions.rb, line 103
def initialize(method, path, response)
  @method = method
  @path = path
  @code = response.code
  @body = response.body.to_s
  @body = @body.empty? ? "<none>" : "#{response.body}"
  message = "Unexpected server response:\n  Method: #{@method}\n  Path: "         "#{@path}\n  Code: #{@code}\n  Body: #{@body}"
  super message
end