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 / BadResponseException.php

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

40 lines 1.1 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\Message\RequestInterface;
6 use Plausible\Analytics\WP\Client\Lib\Psr\Http\Message\ResponseInterface;
7
8 /**
9 * Exception when an HTTP error occurs (4xx or 5xx error)
10 */
11 class BadResponseException extends RequestException
12 {
13 public function __construct(
14 string $message,
15 RequestInterface $request,
16 ResponseInterface $response,
17 ?\Throwable $previous = null,
18 array $handlerContext = []
19 ) {
20 parent::__construct($message, $request, $response, $previous, $handlerContext);
21 }
22
23 /**
24 * Current exception and the ones that extend it will always have a response.
25 */
26 public function hasResponse(): bool
27 {
28 return true;
29 }
30
31 /**
32 * This function narrows the return type from the parent class and does not allow it to be nullable.
33 */
34 public function getResponse(): ResponseInterface
35 {
36 /** @var ResponseInterface */
37 return parent::getResponse();
38 }
39 }
40