Skip to content

Commit

Permalink
Add support for elastica 8, fixes #1917
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 9, 2024
1 parent 67cc550 commit e266d7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10.5.17",
"predis/predis": "^1.1 || ^2",
"ruflin/elastica": "^7",
"ruflin/elastica": "^7 || ^8",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
Expand Down Expand Up @@ -72,6 +72,9 @@
"config": {
"lock": false,
"sort-packages": true,
"platform-check": false
"platform-check": false,
"allow-plugins": {
"php-http/discovery": false
}
}
}
3 changes: 2 additions & 1 deletion src/Monolog/Handler/ElasticaHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Monolog\Handler;

use Elastic\Transport\Exception\TransportException;
use Elastica\Document;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\ElasticaFormatter;
Expand Down Expand Up @@ -133,7 +134,7 @@ protected function bulkSend(array $documents): void
{
try {
$this->client->addDocuments($documents);
} catch (ExceptionInterface $e) {
} catch (ExceptionInterface | TransportException $e) {
if (!$this->options['ignore_error']) {
throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e);
}
Expand Down

0 comments on commit e266d7d

Please sign in to comment.