Changeset 4538

Show
Ignore:
Timestamp:
10/02/08 07:00:25 (2 months ago)
Author:
ed
Message:

Improved the reporting of errors when a connection test fails. The prior confusion was the result of a bare except handler that treated all failures identically. Now ImportErrors? will be reported accurately, and conneciton errors will also provide better information.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ide/CxnEditor.py

    r4039 r4538  
    274274        # Create a connection object. 
    275275        ci = dabo.db.dConnectInfo(connInfo=self.connDict[self.currentConn]) 
     276        mb = dui.stop 
     277        mbTitle = _("Connection Test") 
    276278        try: 
    277279            conn = ci.getConnection() 
    278280            conn.close() 
    279         except: 
    280             conn = None 
    281          
    282         if conn: 
    283281            msg = _("The connection was successful!") 
    284282            mb = dui.info 
    285         else: 
    286             msg = _("Unable to make connection") 
    287             mb = dui.stop 
    288         mb(message=msg, title="Connection Test") 
     283        except ImportError, e: 
     284            msg = _("Python Import Error: %s") % e 
     285            mbTitle += _(": FAILED!") 
     286        except StandardError, e: 
     287            msg = _("Could not connect to the database: %s") % e 
     288            mbTitle += _(": FAILED!") 
     289        mb(message=msg, title=mbTitle) 
    289290     
    290291