From e67bd91bd21283dcbafd3e1255ec80006824c7be Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Wed, 27 Nov 2024 15:51:38 +0100 Subject: [PATCH] feat: Add brief logging on raising exception Added brief logging of exception raised on raising exception Feature COG-502 --- cognee/exceptions/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cognee/exceptions/exceptions.py b/cognee/exceptions/exceptions.py index f9228873f..752376f60 100644 --- a/cognee/exceptions/exceptions.py +++ b/cognee/exceptions/exceptions.py @@ -1,5 +1,7 @@ from fastapi import status +import logging +logger = logging.getLogger(__name__) class CogneeApiError(Exception): """Base exception class""" @@ -13,6 +15,10 @@ class CogneeApiError(Exception): self.message = message self.name = name self.status_code = status_code + + # Automatically log the exception details + logger.error(f"{self.name}: {self.message} (Status code: {self.status_code})") + super().__init__(self.message, self.name)