On this page
Requests_Exception_HTTP::get_class( int|bool $code ): string
Get the correct exception class for a given error code
Parameters
$codeint|bool Required-
HTTP status code, or false if unavailable
Return
string Exception class name to use
Source
File: wp-includes/Requests/Exception/HTTP.php. View all references
public static function get_class($code) {
if (!$code) {
return 'Requests_Exception_HTTP_Unknown';
}
$class = sprintf('Requests_Exception_HTTP_%d', $code);
if (class_exists($class)) {
return $class;
}
return 'Requests_Exception_HTTP_Unknown';
}
Related
Used By
| Used By | Description |
|---|---|
| Requests_Response::throw_for_status() wp-includes/Requests/Response.php | Throws an exception if the request was not successful |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/requests_exception_http/get_class