Merge pull request #4368 from matrix-org/erikj/better_errors

Fixup docstrings for matrixfederationclient
This commit is contained in:
Erik Johnston 2019-01-09 11:39:28 +00:00 committed by GitHub
commit 55c3e853c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 62 deletions

1
changelog.d/4368.misc Normal file
View File

@ -0,0 +1 @@
Add better logging for unexpected errors while sending transactions

View File

@ -229,19 +229,18 @@ class MatrixFederationHttpClient(object):
backoff_on_404 (bool): Back off if we get a 404 backoff_on_404 (bool): Back off if we get a 404
Returns: Returns:
Deferred: resolves with the http response object on success. Deferred[twisted.web.client.Response]: resolves with the HTTP
response object on success.
Fails with ``HttpResponseException``: if we get an HTTP response Raises:
code >= 300 (except 429). HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
Fails with ``RequestSendFailed`` if there were problems connecting to
the remote, due to e.g. DNS failures, connection timeouts etc.
""" """
if timeout: if timeout:
_sec_timeout = timeout / 1000 _sec_timeout = timeout / 1000
@ -516,17 +515,18 @@ class MatrixFederationHttpClient(object):
requests) requests)
Returns: Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result Deferred[dict|list]: Succeeds when we get a 2xx HTTP response. The
will be the decoded JSON body. result will be the decoded JSON body.
Fails with ``HttpResponseException`` if we get an HTTP response Raises:
code >= 300. HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
""" """
request = MatrixFederationRequest( request = MatrixFederationRequest(
@ -570,17 +570,18 @@ class MatrixFederationHttpClient(object):
try the request anyway. try the request anyway.
args (dict): query params args (dict): query params
Returns: Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result Deferred[dict|list]: Succeeds when we get a 2xx HTTP response. The
will be the decoded JSON body. result will be the decoded JSON body.
Fails with ``HttpResponseException`` if we get an HTTP response Raises:
code >= 300. HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
""" """
request = MatrixFederationRequest( request = MatrixFederationRequest(
@ -625,17 +626,18 @@ class MatrixFederationHttpClient(object):
ignore_backoff (bool): true to ignore the historical backoff data ignore_backoff (bool): true to ignore the historical backoff data
and try the request anyway. and try the request anyway.
Returns: Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result Deferred[dict|list]: Succeeds when we get a 2xx HTTP response. The
will be the decoded JSON body. result will be the decoded JSON body.
Fails with ``HttpResponseException`` if we get an HTTP response Raises:
code >= 300. HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
""" """
logger.debug("get_json args: %s", args) logger.debug("get_json args: %s", args)
@ -676,17 +678,18 @@ class MatrixFederationHttpClient(object):
ignore_backoff (bool): true to ignore the historical backoff data and ignore_backoff (bool): true to ignore the historical backoff data and
try the request anyway. try the request anyway.
Returns: Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result Deferred[dict|list]: Succeeds when we get a 2xx HTTP response. The
will be the decoded JSON body. result will be the decoded JSON body.
Fails with ``HttpResponseException`` if we get an HTTP response Raises:
code >= 300. HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
""" """
request = MatrixFederationRequest( request = MatrixFederationRequest(
method="DELETE", method="DELETE",
@ -719,18 +722,20 @@ class MatrixFederationHttpClient(object):
args (dict): Optional dictionary used to create the query string. args (dict): Optional dictionary used to create the query string.
ignore_backoff (bool): true to ignore the historical backoff data ignore_backoff (bool): true to ignore the historical backoff data
and try the request anyway. and try the request anyway.
Returns: Returns:
Deferred: resolves with an (int,dict) tuple of the file length and Deferred[tuple[int, dict]]: Resolves with an (int,dict) tuple of
a dict of the response headers. the file length and a dict of the response headers.
Fails with ``HttpResponseException`` if we get an HTTP response code Raises:
>= 300 HttpResponseException: If we get an HTTP response code >= 300
(except 429).
Fails with ``NotRetryingDestination`` if we are not yet ready NotRetryingDestination: If we are not yet ready to retry this
to retry this server. server.
FederationDeniedError: If this destination is not on our
Fails with ``FederationDeniedError`` if this destination federation whitelist
is not on our federation whitelist RequestSendFailed: If there were problems connecting to the
remote, due to e.g. DNS failures, connection timeouts etc.
""" """
request = MatrixFederationRequest( request = MatrixFederationRequest(
method="GET", method="GET",