summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorGergely Polonkai <gergely.polonkai@ericsson.com>2016-02-26 10:22:35 +0100
committerGergely Polonkai <gergely.polonkai@ericsson.com>2016-02-26 10:22:35 +0100
commita53774721a90955cfb6180d332ca9f54f9b5e58a (patch)
tree913ba23284024ab43126a5f684465d5d5fe32bc3 /synapse/rest
parentMerge pull request #606 from matrix-org/markjh/get_enabled (diff)
downloadsynapse-a53774721a90955cfb6180d332ca9f54f9b5e58a.tar.xz
Add error codes for malformed/bad JSON in /login
Signed-off-by: Gergely Polonkai <gergely@polonkaieu>
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/login.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py
index 79101106ac..a4f89aea7b 100644
--- a/synapse/rest/client/v1/login.py
+++ b/synapse/rest/client/v1/login.py
@@ -404,10 +404,10 @@ 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):