Skip to content
Snippets Groups Projects
Commit 3cebaf0b authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Catch all exceptions while deleting an entity

parent bfcb90b2
No related branches found
No related tags found
No related merge requests found
import logging
from uuid import UUID
from django.conf import settings
......@@ -41,6 +42,8 @@ from arkindex.project.mixins import CorpusACLMixin
from arkindex.project.permissions import IsVerified
from arkindex.project.triggers import reindex_start
logger = logging.getLogger(__name__)
class CorpusRoles(CorpusACLMixin, ListCreateAPIView):
"""
......@@ -104,10 +107,12 @@ class EntityDetails(RetrieveUpdateDestroyAPIView):
# Try to delete indexed entity if possible
try:
es_entity = ESEntity.get(id=instance.id.hex)
es_entity.delete()
except NotFoundError:
pass
else:
es_entity.delete()
except Exception as e:
logger.error(f"Failed to delete ES index entity {instance.id}: {e}")
instance.delete()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment