summary refs log tree commit diff
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-15 16:05:51 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-15 16:05:51 +0100
commit34d7896b06ba72c4a7ea28d5c42124a35df121bd (patch)
tree56e6518c7e5f5b19abcb3fe975c4556cf40d42b8
parentUpdated CHANGES and UPGRADE to reflect registration API changes. (diff)
downloadsynapse-34d7896b06ba72c4a7ea28d5c42124a35df121bd.tar.xz
More helpful 400 error messages.
Diffstat (limited to '')
-rw-r--r--synapse/rest/register.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/rest/register.py b/synapse/rest/register.py
index c2c80e70c7..af528a44f6 100644
--- a/synapse/rest/register.py
+++ b/synapse/rest/register.py
@@ -82,6 +82,10 @@ class RegisterRestServlet(RestServlet):
 
         session = (register_json["session"] if "session" in register_json
                   else None)
+        login_type = None
+        if "type" not in register_json:
+            raise SynapseError(400, "Missing 'type' key.")
+
         try:
             login_type = register_json["type"]
             stages = {
@@ -106,7 +110,7 @@ class RegisterRestServlet(RestServlet):
             defer.returnValue((200, response))
         except KeyError as e:
             logger.exception(e)
-            raise SynapseError(400, "Missing JSON keys or bad login type.")
+            raise SynapseError(400, "Missing JSON keys for login type %s." % login_type)
 
     def on_OPTIONS(self, request):
         return (200, {})