diff options
author | David Baker <dbkr@users.noreply.github.com> | 2017-05-03 11:23:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-03 11:23:25 +0100 |
commit | 60833c8978d9f25c2d6c59c809c9b14a8f7e89e7 (patch) | |
tree | 1678fc6711c54fecfe94b4608f47a2f6d4ff5529 /synapse/api/errors.py | |
parent | Merge pull request #2175 from matrix-org/erikj/prefill_state (diff) | |
parent | No need for the exception variable (diff) | |
download | synapse-60833c8978d9f25c2d6c59c809c9b14a8f7e89e7.tar.xz |
Merge pull request #2147 from matrix-org/dbkr/http_request_propagate_error
Propagate errors sensibly from proxied IS requests
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r-- | synapse/api/errors.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py index 6fbd5d6876..d0dfa959dc 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -66,6 +66,17 @@ class CodeMessageException(RuntimeError): return cs_error(self.msg) +class MatrixCodeMessageException(CodeMessageException): + """An error from a general matrix endpoint, eg. from a proxied Matrix API call. + + Attributes: + errcode (str): Matrix error code e.g 'M_FORBIDDEN' + """ + def __init__(self, code, msg, errcode=Codes.UNKNOWN): + super(MatrixCodeMessageException, self).__init__(code, msg) + self.errcode = errcode + + class SynapseError(CodeMessageException): """A base exception type for matrix errors which have an errcode and error message (as well as an HTTP status code). |