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