feat: Add brief logging on raising exception
Added brief logging of exception raised on raising exception Feature COG-502
This commit is contained in:
parent
5d297c50f4
commit
e67bd91bd2
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue