WpOrg\Requests
Response::throw_for_status()
Throws an exception if the request was not successful
Метод класса: Response{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Response = new Response(); $Response->throw_for_status( $allow_redirects );
- $allow_redirects(true|false)
- Set to false to throw on a 3xx as well
По умолчанию: true
Код Response::throw_for_status() Response::throw for status WP 6.3.1
public function throw_for_status($allow_redirects = true) { if ($this->is_redirect()) { if ($allow_redirects !== true) { throw new Exception('Redirection not allowed', 'response.no_redirects', $this); } } elseif (!$this->success) { $exception = Http::get_class($this->status_code); throw new $exception(null, $this); } }