diff --git a/ifex/model/type_checking_constructor_mixin.py b/ifex/model/type_checking_constructor_mixin.py index 4bba815..5eff784 100644 --- a/ifex/model/type_checking_constructor_mixin.py +++ b/ifex/model/type_checking_constructor_mixin.py @@ -63,7 +63,11 @@ def type_checking_constructor(self, *args, **kwargs): for name, value in list(zip(arg_names, args)) + list(kwargs.items()): if not is_correct_type(value, arg_types[name]): - raise TypeError(f'Object construction error: According to specification, value named \'{name}\' must be of type: {arg_types[name]}, but was instead: {type(value)!r}.') + try: + nameinfo = f"Additional Info: The object was named: {self.name}" + except: + nameinfo = "" + raise TypeError(f'Object construction error for class {type(self)}: According to specification, value named \'{name}\' must be of type: {arg_types[name]}, but was instead: {type(value)!r}. {nameinfo}') # Assign field value setattr(self, name, value)