Skip to content

Commit

Permalink
improved type error message readability
Browse files Browse the repository at this point in the history
  • Loading branch information
sezanzeb committed Jan 2, 2025
1 parent 411b5d8 commit 47f9e7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inputremapper/injection/macros/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ def _is_numeric_string(self, value: str) -> bool:
return False

def _type_error_factory(self, value: Any) -> MacroError:
formatted_types = [type_.__name__ for type_ in self.types]
return MacroError(
msg=(
f'Expected "{self.name}" to be one of {self.types}, but got '
f"{type(value)} {value}"
f'Expected "{self.name}" to be one of {formatted_types}, but got '
f'{type(value).__name__} "{value}"'
)
)

0 comments on commit 47f9e7f

Please sign in to comment.