summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorAaron Raimist <aaron@raim.ist>2020-10-14 05:24:58 -0500
committerGitHub <noreply@github.com>2020-10-14 11:24:58 +0100
commitec606ea9e334a17af30a552e4612f96e8e7695fb (patch)
tree10d27144e4ecad8748697075b67c738ddfc5ba79 /synapse/rest
parentMove additional tasks to the background worker, part 4 (#8513) (diff)
downloadsynapse-ec606ea9e334a17af30a552e4612f96e8e7695fb.tar.xz
Add correct M_BAD_JSON error code to /profile/{userId}/displayname (#8517)
Fixes #8029
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/profile.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/profile.py b/synapse/rest/client/v1/profile.py
index b686cd671f..e7fcd2b1ff 100644
--- a/synapse/rest/client/v1/profile.py
+++ b/synapse/rest/client/v1/profile.py
@@ -59,7 +59,9 @@ class ProfileDisplaynameRestServlet(RestServlet):
         try:
             new_name = content["displayname"]
         except Exception:
-            return 400, "Unable to parse name"
+            raise SynapseError(
+                code=400, msg="Unable to parse name", errcode=Codes.BAD_JSON,
+            )
 
         await self.profile_handler.set_displayname(user, requester, new_name, is_admin)