Print expected-vs-actual data types on typecheck failure from check_json()

This commit is contained in:
Paul "LeoNerd" Evans 2014-09-17 15:27:45 +01:00
parent e32cfed1d8
commit 9973298e2a

View file

@ -154,7 +154,8 @@ class SynapseEvent(JsonEncodedObject):
return "Missing %s key" % key
if type(content[key]) != type(template[key]):
return "Key %s is of the wrong type." % key
return "Key %s is of the wrong type (got %s, want %s)" % (
key, type(content[key]), type(template[key]))
if type(content[key]) == dict:
# we must go deeper