Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add correct M_BAD_JSON error code to /profile/{userId}/displayname (#…
Browse files Browse the repository at this point in the history
…8517)

Fixes #8029
  • Loading branch information
aaronraimist authored Oct 14, 2020
1 parent 629a951 commit ec606ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/8517.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error code for `/profile/{userId}/displayname` to be `M_BAD_JSON`.
4 changes: 3 additions & 1 deletion synapse/rest/client/v1/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ async def on_PUT(self, request, user_id):
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)

Expand Down

0 comments on commit ec606ea

Please sign in to comment.