Skip to content

Commit 673c1e9

Browse files
authored
fix: KeyError swallowing in default_serializer (#4420)
1 parent e09e7b0 commit 673c1e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

litestar/serialization/msgspec_hooks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ def default_serializer(value: Any, type_encoders: Mapping[Any, Callable[[Any], A
8787
for base in value.__class__.__mro__[:-1]:
8888
try:
8989
encoder = type_encoders[base]
90-
return encoder(value)
9190
except KeyError:
9291
continue
92+
else:
93+
return encoder(value)
9394

9495
raise TypeError(f"Unsupported type: {type(value)!r}")
9596

0 commit comments

Comments
 (0)