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

Commit

Permalink
Kill off RegistrationError (#6691)
Browse files Browse the repository at this point in the history
This is pretty pointless. Let's just use SynapseError.
  • Loading branch information
richvdh authored Jan 13, 2020
1 parent 2d07c73 commit 326c893
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
1 change: 1 addition & 0 deletions changelog.d/6691.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove redundant RegistrationError class.
6 changes: 0 additions & 6 deletions synapse/api/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ def __init__(self, msg):
)


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.
Expand Down
12 changes: 3 additions & 9 deletions synapse/handlers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@

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
Expand Down Expand Up @@ -165,7 +159,7 @@ def register_user(
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)

Expand All @@ -182,7 +176,7 @@ def register_user(
if not was_guest:
try:
int(localpart)
raise RegistrationError(
raise SynapseError(
400, "Numeric user IDs are reserved for guest users."
)
except ValueError:
Expand Down
2 changes: 0 additions & 2 deletions tests/handlers/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ def get_or_create_user(self, requester, localpart, displayname, password_hash=No
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")
Expand Down

0 comments on commit 326c893

Please sign in to comment.