diff --git a/models/classes/search/tasks/UpdateResourceInIndex.php b/models/classes/search/tasks/UpdateResourceInIndex.php index 039e2a87c8..c97b917e5b 100644 --- a/models/classes/search/tasks/UpdateResourceInIndex.php +++ b/models/classes/search/tasks/UpdateResourceInIndex.php @@ -21,6 +21,7 @@ namespace oat\tao\model\search\tasks; +use Exception; use oat\generis\model\OntologyAwareTrait; use oat\oatbox\action\Action; use oat\tao\model\search\index\DocumentBuilder\IndexDocumentBuilder; @@ -64,7 +65,11 @@ public function __invoke($params): Report /** @var Search $searchService */ $searchService = $this->getServiceLocator()->get(Search::SERVICE_ID); - $numberOfIndexed = $searchService->index([$indexDocument]); + try { + $numberOfIndexed = $searchService->index([$indexDocument]); + } catch (Exception $exception) { + return new Report(Report::TYPE_ERROR, $exception->getMessage()); + } if ($numberOfIndexed === 0) { $type = Report::TYPE_ERROR;