Last change
on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 7 days ago |
Upload new project files
|
-
Property mode
set to
100644
|
File size:
982 bytes
|
Rev | Line | |
---|
[f9c482b] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace GuzzleHttp\Exception;
|
---|
| 4 |
|
---|
| 5 | use Psr\Http\Message\RequestInterface;
|
---|
| 6 | use 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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.