Skip to content

Commit bfd1cf1

Browse files
authored
Merge pull request #240 from kdambekalns/fix-error-handling
BUGFIX: Fix error handling
2 parents a1b77af + 6439909 commit bfd1cf1

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Classes/Command/NodeIndexCommandController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ public function cleanupCommand()
303303
}
304304
} catch (ApiException $exception) {
305305
$response = json_decode($exception->getResponse());
306-
$this->logger->log(sprintf('Nothing removed. ElasticSearch responded with status %s, saying "%s: %s"', $response->status, $response->error->type, $response->error->reason));
306+
if ($response->error instanceof \stdClass) {
307+
$this->logger->log(sprintf('Nothing removed. ElasticSearch responded with status %s, saying "%s: %s"', $response->status, $response->error->type, $response->error->reason));
308+
} else {
309+
$this->logger->log(sprintf('Nothing removed. ElasticSearch responded with status %s, saying "%s"', $response->status, $response->error));
310+
}
307311
}
308312
}
309313

Classes/Driver/AbstractIndexerDriver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ protected function findClosestFulltextRoot(NodeInterface $node)
4747
$closestFulltextNode = $closestFulltextNode->getParent();
4848
if ($closestFulltextNode === null) {
4949
// root of hierarchy, no fulltext root found anymore, abort silently...
50-
$this->logger->log(sprintf('NodeIndexer: No fulltext root found for node %s (%s)', $node->getContextPath(), $node->getIdentifier()), LOG_WARNING, null, 'ElasticSearch (CR)');
50+
if ($node->getPath() !== '/' && $node->getPath() !== '/sites') {
51+
$this->logger->log(sprintf('NodeIndexer: No fulltext root found for node %s (%s)', $node->getContextPath(), $node->getIdentifier()), LOG_WARNING, null, 'ElasticSearch (CR)');
52+
}
5153

5254
return null;
5355
}

0 commit comments

Comments
 (0)