Skip to content

Commit 1043611

Browse files
committed
Add some error logs on major failures.
1 parent 9f6785c commit 1043611

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/IndexRotator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public function __construct(\Elasticsearch\Client $engine, $prefix, LoggerInterf
7878
public function getPrimaryIndex()
7979
{
8080
if (!$this->engine->indices()->exists(['index' => $this->configurationIndexName])) {
81-
throw new Exception\MissingPrimaryIndex('Configuration index not available.');
81+
$this->logger->error('Primary index configuration index not available.');
82+
throw new Exception\MissingPrimaryIndex('Primary index configuration index not available.');
8283
}
8384
$primaryPayload = [
8485
'index' => $this->configurationIndexName,
@@ -88,7 +89,8 @@ public function getPrimaryIndex()
8889
try {
8990
$primary = $this->engine->get($primaryPayload);
9091
} catch (\Elasticsearch\Common\Exceptions\Missing404Exception $e) {
91-
throw new Exception\MissingPrimaryIndex('Configuration index not available.');
92+
$this->logger->error('Primary index does not exist.');
93+
throw new Exception\MissingPrimaryIndex('Primary index not available.');
9294
}
9395
return $primary['_source']['name'];
9496
}

0 commit comments

Comments
 (0)