WP_CLI
RequestsLibrary::is_requests_exception
Check if a given exception was issued by the Requests library.
This is used because we cannot easily catch multiple different exception classes with PHP 5.6. Because of that, we catch generic exceptions, check if they match the Requests library, and re-throw them if they do not.
Метод класса: RequestsLibrary{}
Хуков нет.
Возвращает
true|false. Whether the provided exception was issued by the Requests library.
Использование
$result = RequestsLibrary::is_requests_exception( $exception );
- $exception(Exception) (обязательный)
- Exception to check.
Код RequestsLibrary::is_requests_exception() RequestsLibrary::is requests exception WP-CLI 2.13.0-alpha
public static function is_requests_exception( Exception $exception ) {
return is_a( $exception, '\Requests_Exception' )
|| is_a( $exception, '\WpOrg\Requests\Exception' );
}