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

Add correct M_BAD_JSON error code to /profile/{userId}/displayname #8517

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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