Requests_Exception_HTTP::__construct( string|null $reason = null, mixed $data = null )

Create a new exception


Description

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


Top ↑

Parameters

$reason string|null Optional
Reason phrase

Default: null

$data mixed Optional
Associated data

Default: null


Top ↑

Source

File: wp-includes/Requests/Exception/HTTP.php. View all references

public function __construct($reason = null, $data = null) {
	if ($reason !== null) {
		$this->reason = $reason;
	}

	$message = sprintf('%d %s', $this->code, $this->reason);
	parent::__construct($message, 'httpresponse', $data, $this->code);
}


Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.