Ensured logging of error messages with unrecognized numeric codes. Fixes SR #1859821, but nothing can rectify freenode's idiocy completely.

This commit is contained in:
Jeremy Fincher 2009-03-12 14:04:22 -05:00
parent bc70ab8aad
commit fa9a9cb04d

View File

@ -27,6 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
import re
import copy import copy
import time import time
import random import random
@ -762,6 +763,7 @@ class Irc(IrcCommandDispatcher):
else: else:
return None return None
_numericErrorCommandRe = re.compile(r'^[45][0-9][0-9]$')
def feedMsg(self, msg): def feedMsg(self, msg):
"""Called by the IrcDriver; feeds a message received.""" """Called by the IrcDriver; feeds a message received."""
msg.tag('receivedBy', self) msg.tag('receivedBy', self)
@ -797,6 +799,8 @@ class Irc(IrcCommandDispatcher):
method = self.dispatchCommand(msg.command) method = self.dispatchCommand(msg.command)
if method is not None: if method is not None:
method(msg) method(msg)
elif self._numericErrorCommandRe.search(msg.command):
log.error('Unhandled error message from server: %r' % msg)
# Now update the IrcState object. # Now update the IrcState object.
try: try:
@ -951,7 +955,7 @@ class Irc(IrcCommandDispatcher):
def doError(self, msg): def doError(self, msg):
"""Handles ERROR messages.""" """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 not self.zombie:
if msg.args[0].startswith('Closing Link'): if msg.args[0].startswith('Closing Link'):
self.driver.reconnect() self.driver.reconnect()