Sfoglia il codice sorgente

Kill off RegistrationError (#6691)

This is pretty pointless. Let's just use SynapseError.
tags/v1.9.0.dev1
Richard van der Hoff 4 anni fa
committed by GitHub
parent
commit
326c893d24
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: 4AEE18F83AFDEB23
4 ha cambiato i file con 4 aggiunte e 17 eliminazioni
  1. +1
    -0
      changelog.d/6691.misc
  2. +0
    -6
      synapse/api/errors.py
  3. +3
    -9
      synapse/handlers/register.py
  4. +0
    -2
      tests/handlers/test_register.py

+ 1
- 0
changelog.d/6691.misc Vedi File

@@ -0,0 +1 @@
Remove redundant RegistrationError class.

+ 0
- 6
synapse/api/errors.py Vedi File

@@ -158,12 +158,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.


+ 3
- 9
synapse/handlers/register.py Vedi File

@@ -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
@@ -165,7 +159,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)

@@ -182,7 +176,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:


+ 0
- 2
tests/handlers/test_register.py Vedi File

@@ -269,8 +269,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")


Caricamento…
Annulla
Salva