Skip to content

Commit

Permalink
Format var better in error message (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
picklelo committed Dec 6, 2023
1 parent 0eb374c commit 46d0388
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion reflex/components/component.py
Expand Up @@ -266,8 +266,9 @@ def __init__(self, *args, **kwargs):
passed_type = type(value)
expected_type = fields[key].outer_type_
if not types._issubclass(passed_type, expected_type):
value_name = value._var_name if isinstance(value, Var) else value
raise TypeError(
f"Invalid var passed for prop {key}, expected type {expected_type}, got value {value} of type {passed_type}."
f"Invalid var passed for prop {key}, expected type {expected_type}, got value {value_name} of type {passed_type}."
)

# Check if the key is an event trigger.
Expand Down

0 comments on commit 46d0388

Please sign in to comment.