chore: Add logging to sentry when file which should exist can't be found

Log to sentry that a file which should exist can't be found

Chore COG-475
This commit is contained in:
Igor Ilic 2024-12-20 16:20:40 +01:00
parent d7195f9786
commit 450bef4c91

View file

@ -1,5 +1,6 @@
import os
from os import path
import logging
from uuid import UUID
from typing import Optional
from typing import AsyncGenerator, List
@ -14,6 +15,9 @@ from cognee.modules.data.models.Data import Data
from ..ModelBase import Base
logger = logging.getLogger(__name__)
class SQLAlchemyAdapter():
def __init__(self, connection_string: str):
self.db_path: str = None
@ -142,7 +146,7 @@ class SQLAlchemyAdapter():
os.remove(raw_data_location_entities[0].raw_data_location)
else:
# Report bug as file should exist
pass
logger.error("Local file which should exist can't be found.")
await session.execute(delete(Data).where(Data.id == data_id))
await session.commit()