From 46f8ef1c75de61e0fea01c6c88bc33e117facd70 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 20 Aug 2020 07:17:29 -0400 Subject: [PATCH] Improve the error code when trying to register using a name reserved for guests. --- changelog.d/8135.bugfix | 1 + synapse/handlers/register.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/8135.bugfix diff --git a/changelog.d/8135.bugfix b/changelog.d/8135.bugfix new file mode 100644 index 000000000000..9d5c60ea00e3 --- /dev/null +++ b/changelog.d/8135.bugfix @@ -0,0 +1 @@ +Clarify the error code if a user tries to register with a numeric ID. This bug was introduced in v1.15.0. diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 999bc6efb56a..ccd96e46267a 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -124,7 +124,9 @@ async def check_username( try: int(localpart) raise SynapseError( - 400, "Numeric user IDs are reserved for guest users." + 400, + "Numeric user IDs are reserved for guest users.", + errcode=Codes.INVALID_USERNAME, ) except ValueError: pass