diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-03-23 11:33:40 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-03-23 11:33:40 +0000 |
commit | 262d78a86867b21ac21359862ab8be5c7402e23f (patch) | |
tree | b9a93ed1a37fe56a5e7dcef6631eee93653df4aa | |
parent | Don't assign numeric IDs for empty usernames (#6690) (diff) | |
parent | Kill off RegistrationError (#6691) (diff) | |
download | synapse-262d78a86867b21ac21359862ab8be5c7402e23f.tar.xz |
Kill off RegistrationError (#6691)
* commit '326c893d2': Kill off RegistrationError (#6691)
-rw-r--r-- | changelog.d/6691.misc | 1 | ||||
-rw-r--r-- | synapse/api/errors.py | 6 | ||||
-rw-r--r-- | synapse/handlers/register.py | 12 | ||||
-rw-r--r-- | tests/handlers/test_register.py | 2 |
4 files changed, 4 insertions, 17 deletions
diff --git a/changelog.d/6691.misc b/changelog.d/6691.misc new file mode 100644 index 0000000000..104e9ce648 --- /dev/null +++ b/changelog.d/6691.misc @@ -0,0 +1 @@ +Remove redundant RegistrationError class. diff --git a/synapse/api/errors.py b/synapse/api/errors.py index ee2a295300..cf9710e00a 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -166,12 +166,6 @@ class UserDeactivatedError(SynapseError): ) -class RegistrationError(SynapseError): - """An error raised when a registration event fails.""" - - pass - - class FederationDeniedError(SynapseError): """An error raised when the server tries to federate with a server which is not on its federation whitelist. diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index ba7323c74e..696d90996a 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -20,13 +20,7 @@ from twisted.internet import defer from synapse import types from synapse.api.constants import MAX_USERID_LENGTH, LoginType -from synapse.api.errors import ( - AuthError, - Codes, - ConsentNotGivenError, - RegistrationError, - SynapseError, -) +from synapse.api.errors import AuthError, Codes, ConsentNotGivenError, SynapseError from synapse.config.server import is_threepid_reserved from synapse.http.servlet import assert_params_in_dict from synapse.replication.http.login import RegisterDeviceReplicationServlet @@ -168,7 +162,7 @@ class RegistrationHandler(BaseHandler): Returns: Deferred[str]: user_id Raises: - RegistrationError if there was a problem registering. + SynapseError if there was a problem registering. """ yield self.check_registration_ratelimit(address) @@ -185,7 +179,7 @@ class RegistrationHandler(BaseHandler): if not was_guest: try: int(localpart) - raise RegistrationError( + raise SynapseError( 400, "Numeric user IDs are reserved for guest users." ) except ValueError: diff --git a/tests/handlers/test_register.py b/tests/handlers/test_register.py index ae43c6ea7e..5e7f14a3d5 100644 --- a/tests/handlers/test_register.py +++ b/tests/handlers/test_register.py @@ -290,8 +290,6 @@ class RegistrationTestCase(unittest.HomeserverTestCase): one will be randomly generated. Returns: A tuple of (user_id, access_token). - Raises: - RegistrationError if there was a problem registering. """ if localpart is None: raise SynapseError(400, "Request must include user id") |