PluginProbe
Plausible Analytics / trunk
Plausible Analytics vtrunk
2.6.1 2.6.0 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 52 releases
plausible-analytics / src / Client / lib / Lib / GuzzleHttp / Exception / ConnectException.php

ConnectException.php in Plausible Analytics trunk, at src/Client/lib/Lib/GuzzleHttp/Exception/ConnectException.php

57 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Exception;
4
5 use Plausible\Analytics\WP\Client\Lib\Psr\Http\Client\NetworkExceptionInterface;
6 use Plausible\Analytics\WP\Client\Lib\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 }
57