MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / exception_handler

Function exception_handler

methods/cognee/shared/logging_utils.py:206–221  ·  view source on GitHub ↗

Custom processor to handle uncaught exceptions.

(logger, method_name, event_dict)

Source from the content-addressed store, hash-verified

204 log_level = log_level if log_level else log_levels[os.getenv("LOG_LEVEL", "INFO")]
205
206 def exception_handler(logger, method_name, event_dict):
207 """Custom processor to handle uncaught exceptions."""
208 # Check if there's an exc_info that needs to be processed
209 if event_dict.get("exc_info"):
210 # If it's already a tuple, use it directly
211 if isinstance(event_dict["exc_info"], tuple):
212 exc_type, exc_value, tb = event_dict["exc_info"]
213 else:
214 exc_type, exc_value, tb = sys.exc_info()
215
216 if hasattr(exc_type, __name__):
217 event_dict["exception_type"] = exc_type.__name__
218 event_dict["exception_message"] = str(exc_value)
219 event_dict["traceback"] = True
220
221 return event_dict
222
223 # Configure structlog
224 structlog.configure(

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected