class HTTP::Client::StatusError < HTTP::Client::Error

A response that is not 2xx, from Response#ensure_success. An exception is Shareable and a response's body is not, so it carries the response's status, headers and URL, and its body when it could be read (up to max_body_bytes). The message says the status and the URL, never the body.

<std:http>:2176

Class methods

def self.new(status: Int, headers: HTTP::Headers, url: URI, body: Bytes?) -> HTTP::Client::StatusError

An exception with message, not yet raised.

from Exception

<std:http>:2181

Methods

def status -> Int

The response's status.

<std:http>:2186

def headers -> HTTP::Headers

The response's headers.

<std:http>:2188

def url -> URI

The URL that answered.

<std:http>:2190

def body -> Bytes?

The response's body, nil when it could not be read.

<std:http>:2192