Skip to content

Commit 647b0be

Browse files
committed
improved error text
1 parent be0da2f commit 647b0be

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
1.2.0 - 2022/10/25
22
* [g-pichler] Ability to disable deepcopy on mapping: `use_deepcopy` flag in `map` method.
3+
* [g-pichler] Improved error text when no spec function exists for `target class`.
34
* Updated doc comments.
45

56
1.1.3 - 2022/10/07

automapper/mapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ def _get_fields(self, target_cls: Type[T]) -> Iterable[str]:
242242
if classifier(target_cls):
243243
return self._classifier_specs[classifier](target_cls)
244244

245+
target_cls_name = getattr(target_cls, "__name__", type(target_cls))
245246
raise MappingError(
246-
f"No spec function is added for base class of {type(target_cls)}"
247+
f"No spec function is added for base class of {target_cls_name!r}"
247248
)
248249

249250
def _map_subobject(

0 commit comments

Comments
 (0)