summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/mapper.py
diff options
context:
space:
mode:
authorJohn Perkins <john.d.perkins@gmail.com>2016-08-05 10:26:51 -0600
committerJohn Perkins <john.d.perkins@gmail.com>2016-08-05 11:32:35 -0600
commit1cc68e8cd7d7dc29ff34ae1aca9c43a94ef539f9 (patch)
treeb575893c6ba024b67dbc0f343ce86876d1adafd8 /lib/sqlalchemy/orm/mapper.py
parentf2fa9d000b44a54b0fd3ae6114eb5d53ef20c3b8 (diff)
downloadsqlalchemy-pr/298.tar.gz
Clarify mappers.configure_mappers error messagepr/298
Sometimes the message generated by configure_mappers lacks a reference to the failing mapper, and only the mapper._configure_failed is shown. This makes debugging problems extremely difficult. Example: sqlalchemy.exc.InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Original exception was: Class 'neutron.objects.router.Router' is not mapped In the above failure, the actual object having a problem is FloatingIP, which has a knock-on effect on the Router object when it fails to map. A more helpful error message might look like this example: sqlalchemy.exc.InvalidRequestError: One (Mapper|FloatingIp|floatingip) or more mappers failed to initialize - can't proceed with initialization of other mappers. Original exception was: Class 'neutron.objects.router.Router' is not mapped This patch adds the failing mapper name to the beginning of the message after 'One', as shown in the second example. Change-Id: I9f23bfa90b26dde9229ab7ec812eec9ceae48153
Diffstat (limited to 'lib/sqlalchemy/orm/mapper.py')
-rw-r--r--lib/sqlalchemy/orm/mapper.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index b76a6f727..803d95feb 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -2826,10 +2826,10 @@ def configure_mappers():
for mapper in list(_mapper_registry):
if getattr(mapper, '_configure_failed', False):
e = sa_exc.InvalidRequestError(
- "One or more mappers failed to initialize - "
+ "One (%s) or more mappers failed to initialize - "
"can't proceed with initialization of other "
- "mappers. Original exception was: %s"
- % mapper._configure_failed)
+ "mappers. Original exception was: %s"
+ % (mapper, mapper._configure_failed))
e._configure_failed = mapper._configure_failed
raise e
if not mapper.configured: