fix: Suppress HFP profile rejection DBusError traceback
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
14
main.py
14
main.py
@@ -250,7 +250,21 @@ async def fetch_mqtt():
|
|||||||
loop.create_task(process_mqtt(message))
|
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():
|
async def main():
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
|
loop.set_exception_handler(suppress_hfp_rejection_error)
|
||||||
|
|
||||||
global bus
|
global bus
|
||||||
bus = await MessageBus(bus_type=BusType.SYSTEM).connect()
|
bus = await MessageBus(bus_type=BusType.SYSTEM).connect()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user