From 5ae74e4c9321fc0a5474df790d931d5d794da563 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 11 Jun 2015 00:12:04 +0200 Subject: Do not log unhandled iq errors and timeouts in the error log tends to happen quite often --- src/poezio.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/poezio.py b/src/poezio.py index 7a83f510..9fb6fb73 100644 --- a/src/poezio.py +++ b/src/poezio.py @@ -85,11 +85,18 @@ def main(): cocore.debug = True cocore.start() + from slixmpp.exceptions import IqError, IqTimeout + def swallow_iqerrors(loop, context): + """Do not log unhandled iq errors and timeouts""" + if not isinstance(context['exception'], (IqError, IqTimeout)): + loop.default_exception_handler(context) + # Warning: asyncio must always be imported after the config. Otherwise # the asyncio logger will not follow our configuration and won't write # the tracebacks in the correct file, etc import asyncio loop = asyncio.get_event_loop() + loop.set_exception_handler(swallow_iqerrors) loop.add_reader(sys.stdin, cocore.on_input_readable) loop.add_signal_handler(signal.SIGWINCH, cocore.sigwinch_handler) -- cgit v1.2.3