From 3075174c49b838611499cc77b8345fec8e1e7911 Mon Sep 17 00:00:00 2001 From: Robert Leftwich Date: Thu, 12 Jan 2006 07:33:28 +0000 Subject: [PATCH] r818@lightspeed: robert | 2006-01-12 18:32:38 +1100 Added class name to the TypeError string to make it easier to find constructor problems when mapper is constructing complex mappings --- lib/sqlalchemy/mapping/mapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index a1a3ee5fb3..ff0f1fc878 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -215,7 +215,11 @@ class Mapper(object): def init(self, *args, **kwargs): nohist = kwargs.pop('_mapper_nohistory', False) if oldinit is not None: - oldinit(self, *args, **kwargs) + try: + oldinit(self, *args, **kwargs) + except TypeError, msg: + # re-raise with the offending class name added to help in debugging + raise TypeError, '%s.%s' %(self.__class__.__name__, msg) if not nohist: objectstore.uow().register_new(self) self.class_.__init__ = init -- 2.47.2