Skip to content

Commit 6ecc890

Browse files
committed
fix: review comments
1 parent 7ebe5e1 commit 6ecc890

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

integrations/astra/src/haystack_integrations/document_stores/astra/document_store.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from haystack import default_from_dict, default_to_dict, logging
77
from haystack.dataclasses import Document
8-
from haystack.document_stores.errors import DuplicateDocumentError, MissingDocumentError
8+
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError, MissingDocumentError
99
from haystack.document_stores.types import DuplicatePolicy
1010
from haystack.utils import Secret, deserialize_secrets_inplace
1111

@@ -424,7 +424,12 @@ def delete_all_documents(self) -> None:
424424
Deletes all documents from the document store.
425425
"""
426426
deletion_counter = 0
427-
deletion_counter = self.index.delete_all_documents()
427+
428+
try:
429+
deletion_counter = self.index.delete_all_documents()
430+
except Exception as e:
431+
msg = f"Failed to delete all documents from Astra: {e!s}"
432+
raise DocumentStoreError(msg) from e
428433

429434
if deletion_counter == -1:
430435
logger.info("All documents deleted")

integrations/astra/tests/test_document_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_filter_documents_by_in_operator(self, document_store):
204204
self.assert_documents_are_equal([result[0]], [docs[0]])
205205
self.assert_documents_are_equal([result[1]], [docs[1]])
206206

207-
def test_delete_all_documents_empty_store(self, document_store: AstraDocumentStore):
207+
def test_delete_all_documents(self, document_store: AstraDocumentStore):
208208
"""
209209
Test delete_all_documents() on an Astra.
210210
"""

0 commit comments

Comments
 (0)