pyln-proto: make an error message more detailed

Easier to figure out what's going wrong
This commit is contained in:
niftynei
2021-03-24 16:37:22 -05:00
committed by Rusty Russell
parent 5142dc81f6
commit cbde1f8158

View File

@@ -248,7 +248,7 @@ other types. Since 'msgtype' is almost identical, it inherits from this too.
fieldname, s = s.split('=', 1)
f = self.find_field(fieldname)
if f is None:
raise ValueError("Unknown field name {}".format(fieldname))
raise ValueError("Unknown field name '{}'. Expected one of [{}])".format(fieldname, ','.join(str(f) for f in self.fields)))
ret[fieldname], s = f.fieldtype.val_from_str(s)
if s[0] == ',':
s = s[1:]