Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Dec 20, 2019
1 parent 45b183d commit c861fcb
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/Monolog/Handler/ElasticsearchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,35 +155,35 @@ protected function bulkSend(array $records): void
throw new RuntimeException('Error sending messages to Elasticsearch', 0, $e);
}
}
}
/**
* Creates elasticsearch exception from responses array
*
* Only the first error is converted into an exception.
*
* @param array $responses returned by $this->client->bulk()
*/
protected function createExceptionFromResponses(array $responses): ElasticsearchRuntimeException
{
foreach ($responses['items'] ?? [] as $item) {
if (isset($item['index']['error'])) {
return $this->createExceptionFromError($item['index']['error']);
}
}

return new ElasticsearchRuntimeException('Elasticsearch failed to index one or more records.');
}

/**
* Creates elasticsearch exception from error array
*
* @param array $error
*/
protected function createExceptionFromError(array $error): ElasticsearchRuntimeException
{
$previous = isset($error['caused_by']) ? $this->createExceptionFromError($error['caused_by']) : null;

return new ElasticsearchRuntimeException($error['type'] . ': ' . $error['reason'], 0, $previous);
}
}

/**
* Creates elasticsearch exception from responses array
*
* Only the first error is converted into an exception.
*
* @param array $responses returned by $this->client->bulk()
*/
protected function createExceptionFromResponses(array $responses): ElasticsearchRuntimeException
{
foreach ($responses['items'] ?? [] as $item) {
if (isset($item['index']['error'])) {
return $this->createExceptionFromError($item['index']['error']);
}
}

return new ElasticsearchRuntimeException('Elasticsearch failed to index one or more records.');
}

/**
* Creates elasticsearch exception from error array
*
* @param array $error
*/
protected function createExceptionFromError(array $error): ElasticsearchRuntimeException
{
$previous = isset($error['caused_by']) ? $this->createExceptionFromError($error['caused_by']) : null;

return new ElasticsearchRuntimeException($error['type'] . ': ' . $error['reason'], 0, $previous);
}
}

0 comments on commit c861fcb

Please sign in to comment.