WpOrg\Requests\Exception

Http::__construct()publicWP 1.0

Create a new exception

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

Method of the class: Http{}

No Hooks.

Return

null. Nothing (null).

Usage

$Http = new Http();
$Http->__construct( $reason, $data );
$reason(string|null)
Reason phrase
Default: null
$data(mixed)
Associated data
Default: null

Http::__construct() code WP 6.6.2

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);
}