Skip to content

Commit d883ae8

Browse files
committed
Raise useful exception when encountering wrong type
1 parent 5aa8213 commit d883ae8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pycardano/serialization.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ def _restore_dataclass_field(
420420
f"List types need exactly one type argument, but got {t_args}"
421421
)
422422
t = t_args[0]
423+
if not isinstance(v, list):
424+
raise DeserializeException(f"Expected type list but got {type(v)}")
423425
if isclass(t) and issubclass(t, CBORSerializable):
424426
return IndefiniteList([t.from_primitive(w) for w in v])
425427
else:

0 commit comments

Comments
 (0)