Improve the error code when trying to register using a name reserved for guests. (#8135)

This commit is contained in:
Patrick Cloke 2020-08-20 10:39:41 -04:00 committed by GitHub
parent dbc630a628
commit 592cdf73be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/8135.bugfix Normal file
View File

@ -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.

View File

@ -124,7 +124,9 @@ class RegistrationHandler(BaseHandler):
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