From db983cb69334d890b032e361d0c7c96df05eb212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 16 Dec 2025 17:29:14 -0800 Subject: [PATCH] BaseObject: log file and line number for uncaught exceptions --- src/pipecat/utils/base_object.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pipecat/utils/base_object.py b/src/pipecat/utils/base_object.py index bace5e64b..e77f767f2 100644 --- a/src/pipecat/utils/base_object.py +++ b/src/pipecat/utils/base_object.py @@ -13,6 +13,7 @@ and async cleanup for all Pipecat components. import asyncio import inspect +import traceback from abc import ABC from dataclasses import dataclass from typing import Any, Dict, List, Optional @@ -187,7 +188,11 @@ class BaseObject(ABC): else: handler(self, *args, **kwargs) except Exception as e: - logger.error(f"Exception in event handler {event_name}: {e}") + tb = traceback.extract_tb(e.__traceback__) + last = tb[-1] + logger.error( + f"Uncaught exception in event handler '{event_name}' ({last.filename}:{last.lineno}): {e}" + ) def _event_task_finished(self, task: asyncio.Task): """Clean up completed event handler tasks.