From 2a02dc0f5acab2887fd391c2a1707ec024410462 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 30 Dec 2025 22:15:48 +0000 Subject: [PATCH] fix: Suppress HFP profile rejection DBusError traceback Co-authored-by: aider (gemini/gemini-2.5-pro) --- main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.py b/main.py index 7d993e3..30fc27c 100644 --- a/main.py +++ b/main.py @@ -250,7 +250,21 @@ async def fetch_mqtt(): loop.create_task(process_mqtt(message)) +def suppress_hfp_rejection_error(loop, context): + exception = context.get('exception') + if isinstance(exception, DBusError) and 'HFP profile not supported' in str(exception): + # This is the expected error from AuthorizeService, so we can suppress the traceback. + logging.debug('Suppressed expected DBusError for HFP rejection.') + return + + # For all other exceptions, fall back to the default handler. + loop.default_exception_handler(context) + + async def main(): + loop = asyncio.get_running_loop() + loop.set_exception_handler(suppress_hfp_rejection_error) + global bus bus = await MessageBus(bus_type=BusType.SYSTEM).connect()