summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-22 17:38:53 +0000
committerDavid Baker <dave@matrix.org>2015-01-22 17:38:53 +0000
commitede491b4e0c14d44ce43dd5b152abf148b54b9ed (patch)
tree9393ce6b7beab8158fab5c958b8a957b7f1b1764 /synapse/api/errors.py
parentAdd rest API & store for creating push rules (diff)
downloadsynapse-ede491b4e0c14d44ce43dd5b152abf148b54b9ed.tar.xz
Oops: second part of commit dc938606
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index a4155aebae..55181fe77e 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -21,6 +21,7 @@ logger = logging.getLogger(__name__)
 
 
 class Codes(object):
+    UNRECOGNIZED = "M_UNRECOGNIZED"
     UNAUTHORIZED = "M_UNAUTHORIZED"
     FORBIDDEN = "M_FORBIDDEN"
     BAD_JSON = "M_BAD_JSON"
@@ -82,6 +83,17 @@ class RegistrationError(SynapseError):
     pass
 
 
+class UnrecognizedRequestError(SynapseError):
+    """An error indicating we don't understand the request you're trying to make"""
+    def __init__(self, *args, **kwargs):
+        if "errcode" not in kwargs:
+            kwargs["errcode"] = Codes.NOT_FOUND
+        super(UnrecognizedRequestError, self).__init__(
+            400,
+            "Unrecognized request",
+            **kwargs
+        )
+
 class AuthError(SynapseError):
     """An error raised when there was a problem authorising an event."""