class T2Server::UnexpectedServerResponse

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



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


The HTTP error code of this error.


The method that was called to produce this error.


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 106
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