![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/php-http/httplug/src/Exception/ |
<?php namespace Http\Client\Exception; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; /** * Thrown when a response was received but the request itself failed. * * In addition to the request, this exception always provides access to the response object. * * @author Márk Sági-Kazár <[email protected]> */ class HttpException extends RequestException { /** * @var ResponseInterface */ protected $response; /** * @param string $message */ public function __construct( $message, RequestInterface $request, ResponseInterface $response, \Exception $previous = null ) { parent::__construct($message, $request, $previous); $this->response = $response; $this->code = $response->getStatusCode(); } /** * Returns the response. * * @return ResponseInterface */ public function getResponse() { return $this->response; } /** * Factory method to create a new exception with a normalized error message. */ 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); } }