function HttpException::create
Factory method to create a new exception with a normalized error message.
File
-
vendor/
php-http/ httplug/ src/ Exception/ HttpException.php, line 50
Class
- HttpException
- Thrown when a response was received but the request itself failed.
Namespace
Http\Client\ExceptionCode
public static function create(RequestInterface $request, ResponseInterface $response, ?\Exception $previous = null) {
$message = sprintf('[url] %s [http method] %s [status code] %s [reason phrase] %s', $request->getRequestTarget(), $request->getMethod(), $response->getStatusCode(), $response->getReasonPhrase());
return new static($message, $request, $response, $previous);
}