Oops: second part of commit dc938606

This commit is contained in:
David Baker 2015-01-22 17:38:53 +00:00
parent dc93860619
commit ede491b4e0
6 changed files with 45 additions and 7 deletions

View file

@ -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."""