From 94f5c33397f54303db1262e6e544eaa2c2e5baf8 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 25 Sep 2023 13:25:32 -0100 Subject: [PATCH] PlatformTemporaryException Signed-off-by: Maxence Lange --- lib/Platform/ElasticSearchPlatform.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Platform/ElasticSearchPlatform.php b/lib/Platform/ElasticSearchPlatform.php index 682a153..f36a200 100644 --- a/lib/Platform/ElasticSearchPlatform.php +++ b/lib/Platform/ElasticSearchPlatform.php @@ -33,6 +33,7 @@ use Elastic\Elasticsearch\Client; use Elastic\Elasticsearch\ClientBuilder; +use Elastic\Transport\Exception\NoNodeAvailableException; use Exception; use InvalidArgumentException; use OCA\FullTextSearch_Elasticsearch\Exceptions\AccessIsEmptyException; @@ -186,8 +187,6 @@ public function resetIndex(string $providerId) { */ public function indexDocument(IIndexDocument $document): IIndex { $document->initHash(); - - $index = null; try { $result = $this->indexService->indexDocument($this->getClient(), $document); $index = $this->indexService->parseIndexResult($document->getIndex(), $result); @@ -198,6 +197,9 @@ public function indexDocument(IIndexDocument $document): IIndex { ); return $index; + } catch (NoNodeAvailableException $e) { + // replace with \OCP\FullTextSearch\Exceptions\PlatformTemporaryException for version 28. + throw new \OCA\FullTextSearch\Exceptions\PlatformTemporaryException(); } catch (Exception $e) { $this->manageIndexErrorException($document, $e); }