Requests_Exception_HTTP_Unknown::__construct() WordPress Method

The Requests_Exception_HTTP_Unknown::__construct() method is used to create an exception for when an unknown HTTP status code is returned. This can happen when the server returns a status code that is not recognized by the Requests library.

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

Create a new exception


Description

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


Top ↑

Parameters

$reason

(string|null)(Optional)Reason phrase

Default value: null

$data

(mixed)(Optional)Associated data

Default value: null


Top ↑

Source

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

	public function __construct($reason = null, $data = null) {
		if ($data instanceof Requests_Response) {
			$this->code = $data->status_code;
		}

		parent::__construct($reason, $data);
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.