From b30de397e0740058e99f9245aa22ff4010c5da98 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 4 Jun 2014 22:21:35 -0700 Subject: [PATCH] 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 --- taskflow/persistence/backends/impl_sqlalchemy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/taskflow/persistence/backends/impl_sqlalchemy.py b/taskflow/persistence/backends/impl_sqlalchemy.py index a5ea6061..81f053ea 100644 --- a/taskflow/persistence/backends/impl_sqlalchemy.py +++ b/taskflow/persistence/backends/impl_sqlalchemy.py @@ -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: