Skip to content

Commit

Permalink
getLiveIndex() to give better exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
pmishev committed Feb 10, 2016
1 parent 0b7b0cd commit 8b0f7ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Manager/IndexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,15 @@ public function getLiveIndex()
if (true === $this->getUseAliases()) {
if ($this->getConnection()->existsAlias(['name' => $this->readAlias])) {
$indexName = key($indices->getAlias(['name' => $this->readAlias]));
} else {
throw new Exception(sprintf('Index alias "%s" not found', $this->readAlias));
}
} else {
$indexName = $this->getBaseIndexName();
}

if (!$indexName || !$this->getConnection()->existsIndexOrAlias(['index' => $indexName])) {
throw new Exception('Live index not found');
if (!$this->getConnection()->existsIndexOrAlias(['index' => $indexName])) {
throw new Exception(sprintf('Live index "%s" not found', $indexName));
}

return $indexName;
Expand Down

0 comments on commit 8b0f7ba

Please sign in to comment.