|
13 | 13 |
|
14 | 14 | namespace ApiPlatform\Core\Bridge\Symfony\Bundle\Test; |
15 | 15 |
|
16 | | -use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\ClientException; |
17 | | -use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\ServerException; |
18 | | -use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Exception\RedirectionException; |
19 | 16 | use Symfony\Component\BrowserKit\Response as BrowserKitResponse; |
| 17 | +use Symfony\Component\HttpClient\Exception\ClientException; |
20 | 18 | use Symfony\Component\HttpClient\Exception\JsonException; |
| 19 | +use Symfony\Component\HttpClient\Exception\RedirectionException; |
| 20 | +use Symfony\Component\HttpClient\Exception\ServerException; |
21 | 21 | use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse; |
22 | 22 | use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; |
23 | 23 | use Symfony\Contracts\HttpClient\ResponseInterface; |
@@ -80,15 +80,15 @@ private function checkStatusCode() |
80 | 80 | } |
81 | 81 |
|
82 | 82 | if (500 <= $this->info['http_code']) { |
83 | | - throw new ServerException($message, $this->info['http_code']); |
| 83 | + throw new ServerException($this); |
84 | 84 | } |
85 | 85 |
|
86 | 86 | if (400 <= $this->info['http_code']) { |
87 | | - throw new ClientException($message, $this->info['http_code']); |
| 87 | + throw new ClientException($this); |
88 | 88 | } |
89 | 89 |
|
90 | 90 | if (300 <= $this->info['http_code']) { |
91 | | - throw new RedirectionException($message, $this->info['http_code']); |
| 91 | + throw new RedirectionException($this); |
92 | 92 | } |
93 | 93 | } |
94 | 94 |
|
@@ -134,6 +134,7 @@ public function toArray(bool $throw = true): array |
134 | 134 | } |
135 | 135 |
|
136 | 136 | if ('' === $content = $this->getContent($throw)) { |
| 137 | + throw new TransportExceptionInterface($this); |
137 | 138 | throw new class(sprintf('Response body is empty.', $contentType)) extends \Exception implements TransportExceptionInterface { |
138 | 139 | }; |
139 | 140 | } |
|
0 commit comments