From b1f2078ef179a1bffc9cac9af00fffae0aff88a1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 3 Jul 2019 14:53:22 -0600 Subject: [PATCH] Fix errors --- synapse/api/auth.py | 2 +- synapse/api/errors.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/synapse/api/auth.py b/synapse/api/auth.py index f5a7ee4576..9ade160269 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -525,7 +525,7 @@ class Auth(object): 401, "Token soft logged out", errcode=Codes.UNKNOWN_TOKEN, - softLogout=True, + soft_logout=True, ) # we use ret.get() below because *lots* of unit tests stub out diff --git a/synapse/api/errors.py b/synapse/api/errors.py index 6d88fda38b..091019ebd5 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -85,7 +85,7 @@ class SynapseError(CodeMessageException): errcode (str): Matrix error code e.g 'M_FORBIDDEN' """ - def __init__(self, code, msg, errcode=Codes.UNKNOWN, softLogout=False): + def __init__(self, code, msg, errcode=Codes.UNKNOWN, soft_logout=False): """Constructs a synapse error. Args: @@ -95,9 +95,10 @@ class SynapseError(CodeMessageException): """ super(SynapseError, self).__init__(code, msg) self.errcode = errcode + self.soft_logout = soft_logout def error_dict(self): - return cs_error(self.msg, self.errcode, self.softLogout) + return cs_error(self.msg, self.errcode, self.soft_logout) class ProxiedRequestError(SynapseError): @@ -383,7 +384,7 @@ class RequestSendFailed(RuntimeError): self.can_retry = can_retry -def cs_error(msg, code=Codes.UNKNOWN, softLogout=False, **kwargs): +def cs_error(msg, code=Codes.UNKNOWN, soft_logout=False, **kwargs): """ Utility method for constructing an error response for client-server interactions. @@ -394,7 +395,7 @@ def cs_error(msg, code=Codes.UNKNOWN, softLogout=False, **kwargs): Returns: A dict representing the error response JSON. """ - err = {"error": msg, "errcode": code, "soft_logout": softLogout} + err = {"error": msg, "errcode": code, "soft_logout": soft_logout} for key, value in iteritems(kwargs): err[key] = value return err