Improve exception message

This commit is contained in:
clerie 2022-06-16 22:32:01 +02:00
parent deba76228b
commit 4796d1587b

View File

@ -44,7 +44,7 @@ def cast_dict_to_childtype(t, d):
if t.FIELDS[k] is not None and type(v) != t.FIELDS[k]:
d[k] = t.FIELDS[k](v)
else:
raise KeyError()
raise KeyError("Key '{}' containing '{}' is unknown for {}".format(k, v, t.__name__))
return t(d)