class HTTPX::HTTPError

  1. lib/httpx/errors.rb
Superclass: Error

The exception class for HTTP responses with 4xx or 5xx status.

Methods

Public Class

  1. new

Public Instance

  1. response
  2. status

Attributes

response [R]

The HTTPX::Response response object this exception refers to.

Public Class methods

new(response)

Creates the instance and assigns the HTTPX::Response response.

[show source]
    # File lib/httpx/errors.rb
106 def initialize(response)
107   @response = response
108   super("HTTP Error: #{@response.status} #{@response.headers}\n#{@response.body}")
109 end

Public Instance methods

status()

The HTTP response status.

error.status #=> 404
[show source]
    # File lib/httpx/errors.rb
114 def status
115   @response.status
116 end