1 <?php 2 3 namespace GuzzleHttp\Exception; 4 5 use Psr\Http\Client\NetworkExceptionInterface; 6 use Psr\Http\Message\RequestInterface; 7 8 /** 9 * Exception thrown when a connection cannot be established. 10 * 11 * Note that no response is present for a ConnectException 12 */ 13 class ConnectException extends TransferException implements NetworkExceptionInterface 14 { 15 /** 16 * @var RequestInterface 17 */ 18 private $request; 19 20 /** 21 * @var array 22 */ 23 private $handlerContext; 24 25 public function __construct( 26 string $message, 27 RequestInterface $request, 28 \Throwable $previous = null, 29 array $handlerContext = [] 30 ) { 31 parent::__construct($message, 0, $previous); 32 $this->request = $request; 33 $this->handlerContext = $handlerContext; 34 } 35 36 /** 37 * Get the request that caused the exception 38 */ 39 public function getRequest(): RequestInterface 40 { 41 return $this->request; 42 } 43 44 /** 45 * Get contextual information about the error from the underlying handler. 46 * 47 * The contents of this array will vary depending on which handler you are 48 * using. It may also be just an empty array. Relying on this data will 49 * couple you to a specific handler, but can give more debug information 50 * when needed. 51 */ 52 public function getHandlerContext(): array 53 { 54 return $this->handlerContext; 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body