Include the function name on internal errors

To make it easier to debug and reason about the
exception that occurred include the function name
that was called during the sessions activation in
the exception message (and associated LOG output).

Change-Id: I21f9310f78968d1e60d88b1f77be0dc629e75525
This commit is contained in:
Joshua Harlow
2014-06-04 22:21:35 -07:00
committed by Thomas Goirand
parent 862b9d5f96
commit b30de397e0

View File

@@ -346,8 +346,11 @@ class Connection(base.Connection):
with session.begin():
return functor(session, *args, **kwargs)
except sa_exc.SQLAlchemyError as e:
LOG.exception('Failed running database session')
raise exc.StorageFailure("Storage backend internal error", e)
LOG.exception("Failed running '%s' within a database session",
functor.__name__)
raise exc.StorageFailure("Storage backend internal error, failed"
" running '%s' within a database"
" session" % functor.__name__, e)
def _make_session(self):
try: