Requests_Exception_HTTP::__construct

Advertisement

Summery Summery

Create a new exception

Syntax Syntax

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

Description Description

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

Parameters Parameters

$reason

(Optional) Reason phrase

Default value: null

$data

(Optional) Associated data

Default value: null

Source Source

File: wp-includes/Requests/Exception/HTTP.php

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

Advertisement

Advertisement

Leave a Reply