From 9fb9f68c42a9b1179f5bfca59e9e9976fcec323f Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:36:31 +0200 Subject: [PATCH] adds new base errors to retrieval exceptions --- .../modules/retrieval/exceptions/exceptions.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cognee/modules/retrieval/exceptions/exceptions.py b/cognee/modules/retrieval/exceptions/exceptions.py index a403f3e44..3e934909b 100644 --- a/cognee/modules/retrieval/exceptions/exceptions.py +++ b/cognee/modules/retrieval/exceptions/exceptions.py @@ -1,8 +1,8 @@ from fastapi import status -from cognee.exceptions import CogneeApiError, CriticalError +from cognee.exceptions import CogneeValidationError, CogneeSystemError -class SearchTypeNotSupported(CogneeApiError): +class SearchTypeNotSupported(CogneeValidationError): def __init__( self, message: str = "CYPHER search type not supported by the adapter.", @@ -12,7 +12,7 @@ class SearchTypeNotSupported(CogneeApiError): super().__init__(message, name, status_code) -class CypherSearchError(CogneeApiError): +class CypherSearchError(CogneeSystemError): def __init__( self, message: str = "An error occurred during the execution of the Cypher query.", @@ -22,11 +22,17 @@ class CypherSearchError(CogneeApiError): super().__init__(message, name, status_code) -class NoDataError(CriticalError): - message: str = "No data found in the system, please add data first." +class NoDataError(CogneeValidationError): + def __init__( + self, + message: str = "No data found in the system, please add data first.", + name: str = "NoDataError", + status_code: int = status.HTTP_404_NOT_FOUND, + ): + super().__init__(message, name, status_code) -class CollectionDistancesNotFoundError(CogneeApiError): +class CollectionDistancesNotFoundError(CogneeValidationError): def __init__( self, message: str = "No collection distances found for the given query.",