From fa9a9cb04dd1921b37f597cc267b945ce382b671 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 12 Mar 2009 14:04:22 -0500 Subject: [PATCH] Ensured logging of error messages with unrecognized numeric codes. Fixes SR #1859821, but nothing can rectify freenode's idiocy completely. --- src/irclib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/irclib.py b/src/irclib.py index a16822f88..c87c15768 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -27,6 +27,7 @@ # POSSIBILITY OF SUCH DAMAGE. ### +import re import copy import time import random @@ -762,6 +763,7 @@ class Irc(IrcCommandDispatcher): else: return None + _numericErrorCommandRe = re.compile(r'^[45][0-9][0-9]$') def feedMsg(self, msg): """Called by the IrcDriver; feeds a message received.""" msg.tag('receivedBy', self) @@ -797,6 +799,8 @@ class Irc(IrcCommandDispatcher): method = self.dispatchCommand(msg.command) if method is not None: method(msg) + elif self._numericErrorCommandRe.search(msg.command): + log.error('Unhandled error message from server: %r' % msg) # Now update the IrcState object. try: @@ -951,7 +955,7 @@ class Irc(IrcCommandDispatcher): def doError(self, msg): """Handles ERROR messages.""" - log.info('Error message from %s: %s', self.network, msg.args[0]) + log.warning('Error message from %s: %s', self.network, msg.args[0]) if not self.zombie: if msg.args[0].startswith('Closing Link'): self.driver.reconnect()