summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-06-11 00:12:04 +0200
committermathieui <mathieui@mathieui.net>2015-06-11 00:12:04 +0200
commit5ae74e4c9321fc0a5474df790d931d5d794da563 (patch)
treea13ec5cb78a377a37485e0096b5a611ec9ad1237 /src
parentf07689094413c2f600712cdddf92390f8e7a0a27 (diff)
downloadpoezio-5ae74e4c9321fc0a5474df790d931d5d794da563.tar.gz
poezio-5ae74e4c9321fc0a5474df790d931d5d794da563.tar.bz2
poezio-5ae74e4c9321fc0a5474df790d931d5d794da563.tar.xz
poezio-5ae74e4c9321fc0a5474df790d931d5d794da563.zip
Do not log unhandled iq errors and timeouts in the error log
tends to happen quite often
Diffstat (limited to 'src')
-rw-r--r--src/poezio.py7
1 files changed, 7 insertions, 0 deletions
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)