summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-10-22 11:44:31 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-10-22 11:44:31 +0100
commite60dad86ba8528d81ffcd1123bf8aa019110bb5d (patch)
treec415815347a24127f72886beb45bd8f71619d89c /synapse/api/errors.py
parentMerge pull request #318 from matrix-org/syn-502-login-bad-emails (diff)
downloadsynapse-e60dad86ba8528d81ffcd1123bf8aa019110bb5d.tar.xz
Reject events which are too large
SPEC-222
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index d1356eb4d9..b3fea27d0e 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -119,6 +119,15 @@ class AuthError(SynapseError):
         super(AuthError, self).__init__(*args, **kwargs)
 
 
+class EventSizeError(SynapseError):
+    """An error raised when an event is too big."""
+
+    def __init__(self, *args, **kwargs):
+        if "errcode" not in kwargs:
+            kwargs["errcode"] = Codes.TOO_LARGE
+        super(EventSizeError, self).__init__(413, *args, **kwargs)
+
+
 class EventStreamError(SynapseError):
     """An error raised when there a problem with the event stream."""
     def __init__(self, *args, **kwargs):