Exception based on HTTP response

package Requests
inherited_from \Requests_Exception

 Methods

Create a new exception

__construct(string|null $reason = null, mixed $data = null

There is no mechanism to pass in the status code, as this is set by the subclass used. Reason phrases can vary, however.

inherited_from \Requests_Exception::__construct()

Parameters

$reason

stringnull

Reason phrase

$data

mixed

Associated data

Create a new exception

__construct(string $message, string $type, mixed $data = null, integer $code = 0
Inherited

Parameters

$message

string

Exception message

$type

string

Exception type

$data

mixed

Associated data

$code

integer

Exception numerical code, if applicable

Gives any relevant data

getData() : mixed
Inherited
codeCoverageIgnore

Returns

mixed

Get the status message

getReason() 

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

getType() : string
Inherited
codeCoverageIgnore

Returns

string

Get the correct exception class for a given error code

get_class(integer|boolean $code) : string
Static

Parameters

$code

integerboolean

HTTP status code, or false if unavailable

Returns

stringException class name to use

 Properties

 

HTTP status code

$code : integer

Default

0
 

Data associated with the exception

$data : mixed

Default

 

Reason phrase

$reason : string

Default

'Unknown'
 

Type of exception

$type : string

Default