Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pydantic_extra_types/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def parse_color_value(value: int | str, max_val: int = 255) -> float:
"""
try:
color = float(value)
except ValueError as e:
except (ValueError, TypeError) as e:
raise PydanticCustomError(
'color_error',
'value is not a valid color: color values must be a valid number',
Expand Down
1 change: 1 addition & 0 deletions tests/test_types_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def test_color_success(raw_color, as_tuple):
(0, 0, 1128, 0.5),
(0, 0, 1128, -0.5),
(0, 0, 1128, 1.5),
({}, 0, 0),
# rgb/rgba strings
'rgb(0, 0, 1205)',
'rgb(0, 0, 1128)',
Expand Down