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
106 def initialize(method, path, response)
107   @method = method
108   @path = path
109   @code = response.code
110   @body = response.body.to_s
111   @body = @body.empty? ? "<none>" : "#{response.body}"
112   message = "Unexpected server response:\n  Method: #{@method}\n  Path: "\
113     "#{@path}\n  Code: #{@code}\n  Body: #{@body}"
114   super message
115 end