Requests 2.0.0 API

StatusUnknown extends Http
in package

Exception for unknown status responses

Table of Contents

$code  : int|bool
HTTP status code
$data  : mixed
Data associated with the exception
$reason  : string
Reason phrase
$type  : string
Type of exception
__construct()  : mixed
Create a new exception
get_class()  : string
Get the correct exception class for a given error code
getData()  : mixed
Gives any relevant data
getReason()  : string
Get the status message.
getType()  : string
Like {@see \Exception::getCode()}, but a string code.

Properties

$code

HTTP status code

protected int|bool $code = 0

Code if available, false if an error occurred

$data

Data associated with the exception

protected mixed $data

$type

Type of exception

protected string $type

Methods

__construct()

Create a new exception

public __construct([string|null $reason = null ][, mixed $data = null ]) : mixed

If $data is an instance of Response, uses the status code from it. Otherwise, sets as 0

Parameters
$reason : string|null = null

Reason phrase

$data : mixed = null

Associated data

Return values
mixed

get_class()

Get the correct exception class for a given error code

public static get_class(int|bool $code) : string
Parameters
$code : int|bool

HTTP status code, or false if unavailable

Return values
string

Exception class name to use

getData()

Gives any relevant data

public getData() : mixed
Return values
mixed

getReason()

Get the status message.

public getReason() : string
Return values
string

getType()

Like {@see \Exception::getCode()}, but a string code.

public getType() : string
Return values
string

Search results