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.

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