Commits

Marcin Kasperski  committed b2193d5

Attempt to replace bugs like:

Exception during keepalive wakeup: 'NoneType' object has no attribute 'allocate'
Traceback (most recent call last):
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/support/keep_alive.py";, line 134, in _wakeup
dfr = self._command()
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/fics_connector.py";, line 385, in <lambda>
command=lambda: self.run_command("date"),
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/fics_connector.py";, line 320, in run_command
d = self.run_command_ext(command)
File "/home/marcink/watchbot_run/mekk.fics/src/mekk/fics/fics_connector.py";, line 329, in run_command_ext
id, d = self._reply_deferreds.allocate()
AttributeError: 'NoneType' object has no attribute 'allocate'

with better error (the thing happens when we try run_command on disconnected object).

  • Participants
  • Parent commits 8199966

Comments (0)

Files changed (1)

File src/mekk/fics/fics_connector.py

     def run_command_ext(self, command):
         if type(command) is unicode:
             command = str(command)
+        if not self._reply_deferreds:
+            #raise errors.Disconnected("Attempt to run FICS command while we are not logged in")
+            return defer.fail(
+                errors.Disconnected("Attempt to run FICS command while we are not logged in") )
         id, d = self._reply_deferreds.allocate()
         line_to_send = '%d %s' % (id, command)
         self._line_sender.execute(line_to_send)