From d19d3b75836703faa3262ec11a832d850b7bf273 Mon Sep 17 00:00:00 2001 From: phernandez Date: Sat, 11 Jan 2025 22:20:30 -0600 Subject: [PATCH] error on path not found in sync --- src/basic_memory/sync/entity_sync_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/basic_memory/sync/entity_sync_service.py b/src/basic_memory/sync/entity_sync_service.py index 42c415ac..76f4f84c 100644 --- a/src/basic_memory/sync/entity_sync_service.py +++ b/src/basic_memory/sync/entity_sync_service.py @@ -5,6 +5,7 @@ from loguru import logger from basic_memory.models import Entity as EntityModel, Observation, Relation, ObservationCategory from basic_memory.markdown.schemas import EntityMarkdown from basic_memory.repository import EntityRepository, ObservationRepository, RelationRepository +from basic_memory.services.exceptions import EntityNotFoundError def entity_model_from_markdown(file_path: str, markdown: EntityMarkdown) -> EntityModel: @@ -77,6 +78,8 @@ class EntitySyncService: """ logger.debug(f"Updating entity and observations: {path_id}") db_entity = await self.entity_repository.get_by_path_id(path_id) + if not db_entity: + raise EntityNotFoundError(f"Entity not found: {path_id}") # Update fields from markdown db_entity.name = markdown.frontmatter.title