LogToIrc: better error handling

This commit is contained in:
Valentin Lorentz 2021-03-11 00:40:28 +01:00
parent f0b4332908
commit 7359ddce90

View File

@ -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: