Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions backend/python/app/services/graph_db/arango/arango.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,24 +388,21 @@ async def batch_upsert_documents(self, collection_name: str, documents: List[Dic

async def get_document(self, collection_name: str, document_key: str) -> Optional[Dict[str, Any]]:
"""Get a document by key from a collection"""
db = self.db
if not db:
self.logger.error("Database not connected")
return None
try:
if not self.db:
self.logger.error("Database not connected")
return None

collection = self.db.collection(collection_name)

try:
document = collection.get(document_key)
return document
except Exception:
# Document not found
return None

collection = db.collection(collection_name)
document = collection.get(document_key)
except Exception as e:
self.logger.error(f"Failed to get document {document_key} from {collection_name}: {e}")
# Document not found or other collection/db error
# We want to log only on extreme failures (outer exception), as in the original;
# On not-found or other inner exceptions, just return None.
return None

return document

async def delete_document(self, collection_name: str, document_key: str) -> bool:
"""Delete a document by key from a collection"""
try:
Expand Down