Merge "Add some more debugging to Database:__init__"

This commit is contained in:
Jenkins 2016-11-14 16:57:35 +00:00 committed by Gerrit Code Review
commit e6c743573b
1 changed files with 6 additions and 0 deletions

View File

@ -314,9 +314,15 @@ class DataBase(object):
c = engine.connect()
c.close()
except (OperationalError, InternalError) as e:
if DEBUG:
print("Database:__init__: Caught %s" % (e, ))
# engine.connect will throw sqlalchemy.exc exception
if isinstance(e, InternalError):
(num, msg) = e.orig.args
if DEBUG:
print("Database:__init__: (%d,%s)" % (num, msg, ))
if num != 1049 or msg != "Unknown database 'MoltenIron'":
# If it is not the above then reraise it!
raise
# It does not! Create it.
# CREATE DATABASE MoltenIron;