_tryToConnect hides some exceptions
-----------------------------------

                 Key: QPID-1512
                 URL: https://issues.apache.org/jira/browse/QPID-1512
             Project: Qpid
          Issue Type: Bug
          Components: Qpid Managment Framework
    Affects Versions: M4
         Environment: [EMAIL PROTECTED] ~]$ uname -a
Linux localhost.localdomain 2.6.26.6-49.fc8 #1 SMP Fri Oct 17 15:59:36 EDT 2008 
i686 i686 i386 GNU/Linux
[EMAIL PROTECTED] ~]$ cat /etc/redhat-release 
Fedora release 8 (Werewolf)
[EMAIL PROTECTED] ~]$ python -V
Python 2.5.1

            Reporter: Justin Ross
            Priority: Minor


_tryToConnect is currently using Exception to signal connection failure, and a 
result, any exception (say, from a programming error), simply causes a retry 
and doesn't report the exception content.

Here's a patch that seems to work.  It was *not* extensively tested.

[EMAIL PROTECTED] qpid]$ svn diff
Index: python/qmf/console.py
===================================================================
--- python/qmf/console.py       (revision 722628)
+++ python/qmf/console.py       (working copy)
@@ -1191,7 +1191,7 @@
           delay = self.DELAY_MIN
         finally:
           self.cv.release()
-      except:
+      except ConnectionException:
         if delay < self.DELAY_MAX:
           delay *= self.DELAY_FACTOR
       try:
@@ -1332,13 +1332,13 @@
 
     except socket.error, e:
       self.error = "Socket Error %s - %s" % (e[0], e[1])
-      raise Exception(self.error)
+      raise ConnectionException(self.error)
     except Closed, e:
       self.error = "Connect Failed %d - %s" % (e[0], e[1])
-      raise Exception(self.error)
+      raise ConnectionException(self.error)
     except ConnectionFailed, e:
       self.error = "Connect Failed %d - %s" % (e[0], e[1])
-      raise Exception(self.error)
+      raise ConnectionException(self.error)
 
   def _updateAgent(self, obj):
     bankKey = (obj.brokerBank, obj.agentBank)
@@ -1548,6 +1548,9 @@
   def getSchema(self):
     return self.schema
 
+class ConnectionException(Exception):
+  pass
+
 class SequenceManager:
   """ Manage sequence numbers for asynchronous method calls """
   def __init__(self):


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to