diff options
author | David Baker <dave@matrix.org> | 2015-01-22 17:38:53 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2015-01-22 17:38:53 +0000 |
commit | ede491b4e0c14d44ce43dd5b152abf148b54b9ed (patch) | |
tree | 9393ce6b7beab8158fab5c958b8a957b7f1b1764 /synapse/api/errors.py | |
parent | Add rest API & store for creating push rules (diff) | |
download | synapse-ede491b4e0c14d44ce43dd5b152abf148b54b9ed.tar.xz |
Oops: second part of commit dc938606
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r-- | synapse/api/errors.py | 12 |
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.""" |