8
8
use Elastic \Elasticsearch \Exception \MissingParameterException ;
9
9
use Elastic \Elasticsearch \Exception \ServerResponseException ;
10
10
use Symfony \Component \HttpFoundation \Response ;
11
- use Symfony \Component \HttpKernel \Exception \HttpException ;
12
- use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
13
11
use Symfony \Contracts \HttpClient \Exception \ClientExceptionInterface ;
14
12
use Symfony \Contracts \HttpClient \Exception \DecodingExceptionInterface ;
15
13
use Symfony \Contracts \HttpClient \Exception \RedirectionExceptionInterface ;
@@ -60,19 +58,19 @@ public function process(string $indexName, string $url): void
60
58
* @throws RedirectionExceptionInterface
61
59
* @throws ServerExceptionInterface
62
60
* @throws TransportExceptionInterface
63
- * @throws HttpException
61
+ * @throws \ HttpException
64
62
*/
65
63
private function download (string $ url ): array
66
64
{
67
65
// Load from local file if using "file" URL scheme.
68
66
if (preg_match ('~^file://(?<path>/.+)$~ ' , $ url , $ matches )) {
69
67
$ path = $ matches ['path ' ];
70
68
if (!is_readable ($ path )) {
71
- throw new NotFoundHttpException ('Unable to download fixture data ' );
69
+ throw new \ HttpException ('Unable to load fixture data ' );
72
70
}
73
71
$ data = json_decode (file_get_contents ($ path ), true );
74
72
if (empty ($ data )) {
75
- throw new NotFoundHttpException ('Unable to download fixture data ' );
73
+ throw new \ HttpException ('Unable to load fixture data ' );
76
74
}
77
75
78
76
return $ data ;
@@ -81,7 +79,7 @@ private function download(string $url): array
81
79
$ response = $ this ->httpClient ->request ('GET ' , $ url );
82
80
83
81
if (Response::HTTP_OK !== $ response ->getStatusCode ()) {
84
- throw new NotFoundHttpException ('Unable to download fixture data ' );
82
+ throw new \ HttpException ('Unable to download fixture data ' );
85
83
}
86
84
87
85
return $ response ->toArray ();
0 commit comments