provide more details when db connection is failing
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 22 Jan 2013 10:15:39 +0000 (11:15 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 22 Jan 2013 10:15:39 +0000 (11:15 +0100)
sfa/storage/alchemy.py

index 30d3e56..a032a84 100644 (file)
@@ -38,8 +38,11 @@ class Alchemy:
             except:
                 pass
         self.engine=None
-        raise Exception,"Could not connect to database"
-                
+        logger.warning("Could not connect to database: db=%s, user=%s, host=%s, port=%s" % \
+                           (dbname, config.SFA_DB_USER, config.SFA_DB_HOST, config.SFA_DB_PORT))
+        logger.debug("Using password=%s"%config.SFA_DB_PASSWORD)
+        raise Exception,"Could not connect to database %s as %s"%(dbname,config.SFA_DB_USER)
+
 
     # expects boolean True: debug is ON or False: debug is OFF
     def debug (self, echo):