summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2016-02-26 11:12:00 +0000
committerDavid Baker <dbkr@users.noreply.github.com>2016-02-26 11:12:00 +0000
commit9329cd5f13734010aa57ddb0fbb8d1dce90f4e9b (patch)
tree564c053a80e6d2d3a22b78aa33a666ef98daaacb
parentMerge pull request #606 from matrix-org/markjh/get_enabled (diff)
parentFix to appease the PEP8 dragon (diff)
downloadsynapse-9329cd5f13734010aa57ddb0fbb8d1dce90f4e9b.tar.xz
Merge pull request #608 from gergelypolonkai/syn-638
Add error codes for malformed/bad JSON in /login
-rw-r--r--synapse/rest/client/v1/login.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py
index 79101106ac..f13272da8e 100644
--- a/synapse/rest/client/v1/login.py
+++ b/synapse/rest/client/v1/login.py
@@ -404,10 +404,12 @@ def _parse_json(request):
     try:
         content = json.loads(request.content.read())
         if type(content) != dict:
-            raise SynapseError(400, "Content must be a JSON object.")
+            raise SynapseError(
+                400, "Content must be a JSON object.", errcode=Codes.BAD_JSON
+            )
         return content
     except ValueError:
-        raise SynapseError(400, "Content not JSON.")
+        raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
 
 
 def register_servlets(hs, http_server):