Exception: HTTP::StatusError

Inherits:
ResponseError show all
Defined in:
lib/http/errors.rb

Overview

When status code indicates an error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ StatusError

Create a new StatusError from a response

Examples:

HTTP::StatusError.new(response)

Parameters:



45
46
47
48
49
# File 'lib/http/errors.rb', line 45

def initialize(response)
  @response = response

  super("Unexpected status code #{response.code}")
end

Instance Attribute Details

#responseHTTP::Response (readonly)

The HTTP response that caused the error

Examples:

error.response

Returns:



35
36
37
# File 'lib/http/errors.rb', line 35

def response
  @response
end