summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-10-23 11:26:03 +0100
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-10-23 11:26:03 +0100
commit216c976399eb2e0806407d357da2ca80374cabea (patch)
tree586ff8802da3917add3507ab49c3e81e390f0387 /synapse/api/errors.py
parentMerge branch 'release-v0.10.1' of github.com:matrix-org/synapse into develop (diff)
parentReject events which are too large (diff)
downloadsynapse-216c976399eb2e0806407d357da2ca80374cabea.tar.xz
Merge pull request #323 from matrix-org/daniel/sizelimits
Reject events which are too large
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):