Skip to content

Commit ad2c86a

Browse files
authored
fix: ignore Missing404Exception when deleting index item
1 parent 7b58424 commit ad2c86a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/CoreShop/Bundle/IndexBundle/Worker/OpenSearchWorker.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use CoreShop\Component\Index\Worker\WorkerDeleteableByIdInterface;
3535
use CoreShop\Component\Registry\ServiceRegistryInterface;
3636
use OpenSearch\Client;
37+
use OpenSearch\Common\Exceptions\Missing404Exception;
3738
use Pimcore\Tool;
3839
use Symfony\Component\EventDispatcher\GenericEvent;
3940
use Symfony\Component\String\Slugger\SluggerInterface;
@@ -127,11 +128,8 @@ public function deleteIndexStructures(IndexInterface $index): void
127128
'index' => $this->getIndexName($index->getName()),
128129
])
129130
;
130-
} catch (\Exception $exception) {
131-
// If the index does not exist, we can ignore the exception
132-
if ($exception->getCode() !== 404) {
133-
throw $exception;
134-
}
131+
} catch (Missing404Exception) {
132+
// If the document does not exist, we can ignore the exception
135133
}
136134
}
137135

0 commit comments

Comments
 (0)