From 9973298e2ac4039b96e923faa984b400ea720b7f Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Wed, 17 Sep 2014 15:27:45 +0100 Subject: [PATCH] Print expected-vs-actual data types on typecheck failure from check_json() --- synapse/api/events/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py index 72c493db5..4fe060801 100644 --- a/synapse/api/events/__init__.py +++ b/synapse/api/events/__init__.py @@ -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