Update deprecated Exception status codes

This commit is contained in:
Daulet Amirkhanov 2025-10-22 17:38:41 +01:00
parent 340fca3383
commit 3e2dbd1846
8 changed files with 9 additions and 9 deletions

View file

@ -56,7 +56,7 @@ class CogneeValidationError(CogneeApiError):
self,
message: str = "A validation error occurred.",
name: str = "CogneeValidationError",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
log=True,
log_level="ERROR",
):

View file

@ -15,7 +15,7 @@ class DatabaseNotCreatedError(CogneeSystemError):
self,
message: str = "The database has not been created yet. Please call `await setup()` first.",
name: str = "DatabaseNotCreatedError",
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code: int = status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)
@ -99,7 +99,7 @@ class EmbeddingException(CogneeConfigurationError):
self,
message: str = "Embedding Exception.",
name: str = "EmbeddingException",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)

View file

@ -15,7 +15,7 @@ class CollectionNotFoundError(CogneeValidationError):
self,
message,
name: str = "CollectionNotFoundError",
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code: int = status.HTTP_422_UNPROCESSABLE_CONTENT,
log=True,
log_level="DEBUG",
):

View file

@ -8,6 +8,6 @@ class FileContentHashingError(Exception):
self,
message: str = "Failed to hash content of the file.",
name: str = "FileContentHashingError",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)

View file

@ -10,7 +10,7 @@ class UnstructuredLibraryImportError(CogneeConfigurationError):
self,
message: str = "Import error. Unstructured library is not installed.",
name: str = "UnstructuredModuleImportError",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)

View file

@ -7,6 +7,6 @@ class PipelineRunFailedError(CogneeSystemError):
self,
message: str = "Pipeline run failed.",
name: str = "PipelineRunFailedError",
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code: int = status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)

View file

@ -7,6 +7,6 @@ class IngestionError(CogneeValidationError):
self,
message: str = "Failed to load data.",
name: str = "IngestionError",
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
):
super().__init__(message, name, status_code)

View file

@ -12,7 +12,7 @@ class WrongDataDocumentInputError(CogneeValidationError):
self,
field: str,
name: str = "WrongDataDocumentInputError",
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code: int = status.HTTP_422_UNPROCESSABLE_CONTENT,
):
message = f"Missing of invalid parameter: '{field}'."
super().__init__(message, name, status_code)