Skip to content

Commit ddf433c

Browse files
committed
TASK: Fix thrown Exceptions
1 parent 42f8853 commit ddf433c

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

Classes/Domain/Model/Index.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,13 @@ public function exists(): bool
157157
* @param string $content
158158
* @param bool $prefixIndex
159159
* @return Response
160-
* @throws \Exception
160+
* @throws ElasticSearchException
161+
* @throws \Neos\Flow\Http\Exception
161162
*/
162-
public function request(string $method, ?string $path = null, array $arguments = [], ?string $content = null, bool $prefixIndex = true): Response
163+
public function request(string $method, string $path = null, array $arguments = [], string $content = null, bool $prefixIndex = true): Response
163164
{
164165
if ($this->client === null) {
165-
throw new \Exception('The client of the index "' . $this->name . '" is not set, hence no requests can be done.', 1566313883);
166+
throw new ElasticSearchException('The client of the index "' . $this->name . '" is not set, hence no requests can be done.', 1566313883);
166167
}
167168
$path = ($path ? trim($path) : '');
168169
if ($prefixIndex === true) {
@@ -175,8 +176,8 @@ public function request(string $method, ?string $path = null, array $arguments =
175176
}
176177

177178
/**
178-
* @return void
179-
* @throws \Exception
179+
* @throws ElasticSearchException
180+
* @throws \Neos\Flow\Http\Exception
180181
*/
181182
public function create(): void
182183
{
@@ -199,8 +200,8 @@ protected function getSettings()
199200
}
200201

201202
/**
202-
* @return void
203-
* @throws \Exception
203+
* @throws ElasticSearchException
204+
* @throws \Neos\Flow\Http\Exception
204205
*/
205206
public function updateSettings()
206207
{
@@ -217,6 +218,8 @@ public function updateSettings()
217218

218219
/**
219220
* @return void
221+
* @throws ElasticSearchException
222+
* @throws \Neos\Flow\Http\Exception
220223
*/
221224
public function delete()
222225
{
@@ -227,6 +230,8 @@ public function delete()
227230
* Refresh the index
228231
*
229232
* @return void
233+
* @throws ElasticSearchException
234+
* @throws \Neos\Flow\Http\Exception
230235
*/
231236
public function refresh()
232237
{

Classes/Transfer/Exception.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class Exception extends ElasticSearchException
3232
*/
3333
protected $request;
3434

35+
/**
36+
* @param string $message
37+
* @param int $code
38+
* @param ResponseInterface $response
39+
* @param RequestInterface|null $request
40+
* @param \Exception|null $previous
41+
*/
3542
public function __construct($message, $code, ResponseInterface $response, RequestInterface $request = null, \Exception $previous = null)
3643
{
3744
$this->response = $response;

0 commit comments

Comments
 (0)