adds new base errors to retrieval exceptions

This commit is contained in:
hajdul88 2025-08-13 12:36:31 +02:00
parent 5bc00f1143
commit 9fb9f68c42

View file

@ -1,8 +1,8 @@
from fastapi import status from fastapi import status
from cognee.exceptions import CogneeApiError, CriticalError from cognee.exceptions import CogneeValidationError, CogneeSystemError
class SearchTypeNotSupported(CogneeApiError): class SearchTypeNotSupported(CogneeValidationError):
def __init__( def __init__(
self, self,
message: str = "CYPHER search type not supported by the adapter.", message: str = "CYPHER search type not supported by the adapter.",
@ -12,7 +12,7 @@ class SearchTypeNotSupported(CogneeApiError):
super().__init__(message, name, status_code) super().__init__(message, name, status_code)
class CypherSearchError(CogneeApiError): class CypherSearchError(CogneeSystemError):
def __init__( def __init__(
self, self,
message: str = "An error occurred during the execution of the Cypher query.", 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) super().__init__(message, name, status_code)
class NoDataError(CriticalError): class NoDataError(CogneeValidationError):
message: str = "No data found in the system, please add data first." 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__( def __init__(
self, self,
message: str = "No collection distances found for the given query.", message: str = "No collection distances found for the given query.",