summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2018-02-01 18:05:47 -0700
committerGitHub <noreply@github.com>2018-02-01 18:05:47 -0700
commit6e87b34f7b7c595d4e5b96e4a0281b8327e5b8b7 (patch)
tree35701fcc0456593d736a3405f72a5dfd624b1cad /synapse/api/errors.py
parentpep8 (diff)
parentMerge pull request #2837 from matrix-org/rav/fix_quarantine_media (diff)
downloadsynapse-6e87b34f7b7c595d4e5b96e4a0281b8327e5b8b7.tar.xz
Merge branch 'develop' into travis/admin-list-media
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 79b35b3e7c..aa15f73f36 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -46,6 +46,7 @@ class Codes(object):
     THREEPID_AUTH_FAILED = "M_THREEPID_AUTH_FAILED"
     THREEPID_IN_USE = "M_THREEPID_IN_USE"
     THREEPID_NOT_FOUND = "M_THREEPID_NOT_FOUND"
+    THREEPID_DENIED = "M_THREEPID_DENIED"
     INVALID_USERNAME = "M_INVALID_USERNAME"
     SERVER_NOT_TRUSTED = "M_SERVER_NOT_TRUSTED"
 
@@ -140,6 +141,32 @@ class RegistrationError(SynapseError):
     pass
 
 
+class FederationDeniedError(SynapseError):
+    """An error raised when the server tries to federate with a server which
+    is not on its federation whitelist.
+
+    Attributes:
+        destination (str): The destination which has been denied
+    """
+
+    def __init__(self, destination):
+        """Raised by federation client or server to indicate that we are
+        are deliberately not attempting to contact a given server because it is
+        not on our federation whitelist.
+
+        Args:
+            destination (str): the domain in question
+        """
+
+        self.destination = destination
+
+        super(FederationDeniedError, self).__init__(
+            code=403,
+            msg="Federation denied with %s." % (self.destination,),
+            errcode=Codes.FORBIDDEN,
+        )
+
+
 class InteractiveAuthIncompleteError(Exception):
     """An error raised when UI auth is not yet complete