Add some more debugging to Database:__init__

Preserve some history as to why this code is like what it is.

Change-Id: I49e023348996a1ebdf46aeda030511e92efc6223
This commit is contained in:
Mark Hamzy 2016-11-09 16:26:34 -06:00
parent 5f009133dd
commit ffb2c3380f
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;