Add correct M_BAD_JSON error code to /profile/{userId}/displayname (#8517)
Fixes #8029
This commit is contained in:
parent
629a951b49
commit
ec606ea9e3
|
@ -0,0 +1 @@
|
||||||
|
Fix error code for `/profile/{userId}/displayname` to be `M_BAD_JSON`.
|
|
@ -59,7 +59,9 @@ class ProfileDisplaynameRestServlet(RestServlet):
|
||||||
try:
|
try:
|
||||||
new_name = content["displayname"]
|
new_name = content["displayname"]
|
||||||
except Exception:
|
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)
|
await self.profile_handler.set_displayname(user, requester, new_name, is_admin)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue