summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-12-13 13:19:19 +0000
committerGitHub <noreply@github.com>2022-12-13 13:19:19 +0000
commit62ed877433e23ba055cbc69a089c09d03c67681d (patch)
treef156f6de4721c8cfb9259713a37ec49ce9b510eb /synapse/api/errors.py
parentAllow selecting "prejoin" events by state keys (#14642) (diff)
downloadsynapse-62ed877433e23ba055cbc69a089c09d03c67681d.tar.xz
Improve validation of field size limits in events. (#14664)
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 76ef12ed3a..c2c177fd71 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -424,8 +424,17 @@ class ResourceLimitError(SynapseError):
 class EventSizeError(SynapseError):
     """An error raised when an event is too big."""
 
-    def __init__(self, msg: str):
+    def __init__(self, msg: str, unpersistable: bool):
+        """
+        unpersistable:
+            if True, the PDU must not be persisted, not even as a rejected PDU
+            when received over federation.
+            This is notably true when the entire PDU exceeds the size limit for a PDU,
+            (as opposed to an individual key's size limit being exceeded).
+        """
+
         super().__init__(413, msg, Codes.TOO_LARGE)
+        self.unpersistable = unpersistable
 
 
 class LoginError(SynapseError):