summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/api/errors.py1
-rw-r--r--synapse/handlers/register.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index be0c58a4ca..e6d32acced 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -42,6 +42,7 @@ class Codes(object):
     EXCLUSIVE = "M_EXCLUSIVE"
     THREEPID_AUTH_FAILED = "M_THREEPID_AUTH_FAILED"
     THREEPID_IN_USE = "THREEPID_IN_USE"
+    INVALID_USER_NAME = "M_INVALID_USER_NAME"
 
 
 class CodeMessageException(RuntimeError):
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index ba26d13d49..83f4daaa8c 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -53,7 +53,8 @@ class RegistrationHandler(BaseHandler):
             raise SynapseError(
                 400,
                 "User ID must only contain characters which do not"
-                " require URL encoding."
+                " require URL encoding.",
+                Codes.INVALID_USER_NAME
             )
 
         user = UserID(localpart, self.hs.hostname)