Skip to content

Commit

Permalink
improved error text
Browse files Browse the repository at this point in the history
  • Loading branch information
anikolaienko committed Oct 25, 2022
1 parent be0da2f commit 647b0be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.2.0 - 2022/10/25
* [g-pichler] Ability to disable deepcopy on mapping: `use_deepcopy` flag in `map` method.
* [g-pichler] Improved error text when no spec function exists for `target class`.
* Updated doc comments.

1.1.3 - 2022/10/07
Expand Down
3 changes: 2 additions & 1 deletion automapper/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ def _get_fields(self, target_cls: Type[T]) -> Iterable[str]:
if classifier(target_cls):
return self._classifier_specs[classifier](target_cls)

target_cls_name = getattr(target_cls, "__name__", type(target_cls))
raise MappingError(
f"No spec function is added for base class of {type(target_cls)}"
f"No spec function is added for base class of {target_cls_name!r}"
)

def _map_subobject(
Expand Down

0 comments on commit 647b0be

Please sign in to comment.