From 7359ddce90e9fd5ed8572f57879c7b48caf96f8e Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 11 Mar 2021 00:40:28 +0100 Subject: [PATCH] LogToIrc: better error handling --- plugins/LogToIrc/handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/LogToIrc/handler.py b/plugins/LogToIrc/handler.py index 814c126dc..f6843eab3 100644 --- a/plugins/LogToIrc/handler.py +++ b/plugins/LogToIrc/handler.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2004, Stéphan Kochen +# Copyright (c) 2021, Valentin Lorentz # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -57,11 +58,14 @@ class IrcHandler(logging.Handler): msgmaker = ircmsgs.notice msg = msgmaker(target, s) for irc in world.ircs: + if irc.driver is None: + continue try: if not irc.driver.connected: continue except AttributeError as e: - print('*** AttributeError, shouldn\'t happen: %s' % e) + import traceback + traceback.print_exc() continue networks = conf.supybot.plugins.LogToIrc.networks() if networks and irc.network not in networks: