3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

coreplugin: Don't stop iterating if one WHOIS handler errors

This commit is contained in:
James Lu 2015-08-24 18:38:58 -07:00
parent 0d497a8f72
commit 7e449aaada

View File

@ -84,19 +84,18 @@ def handle_whois(irc, source, command, args):
# idle time, so we simply return 0. # idle time, so we simply return 0.
# <- 317 GL GL 15 1437632859 :seconds idle, signon time # <- 317 GL GL 15 1437632859 :seconds idle, signon time
f(irc, server, 317, source, "%s 0 %s :seconds idle, signon time" % (nick, user.ts)) f(irc, server, 317, source, "%s 0 %s :seconds idle, signon time" % (nick, user.ts))
try: for func in utils.whois_handlers:
# Iterate over custom plugin WHOIS handlers. They return a tuple # Iterate over custom plugin WHOIS handlers. They return a tuple
# or list with two arguments: the numeric, and the text to send. # or list with two arguments: the numeric, and the text to send.
for func in utils.whois_handlers: try:
res = func(irc, target) res = func(irc, target)
if res: if res:
num, text = res num, text = res
f(irc, server, num, source, text) f(irc, server, num, source, text)
except Exception as e: except Exception as e:
# Again, we wouldn't want this to crash our service, in case # Again, we wouldn't want this to crash our service, in case
# something goes wrong! # something goes wrong!
log.exception('Error caught in WHOIS handler: %s', e) log.exception('(%s) Error caught in WHOIS handler: %s', irc.name, e)
finally: # 318: End of WHOIS.
# 318: End of WHOIS. f(irc, server, 318, source, "%s :End of /WHOIS list" % nick)
f(irc, server, 318, source, "%s :End of /WHOIS list" % nick)
utils.add_hook(handle_whois, 'WHOIS') utils.add_hook(handle_whois, 'WHOIS')