summary refs log tree commit diff
path: root/synapse/http/matrixfederationclient.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-01-09 09:08:35 +0000
committerGitHub <noreply@github.com>2019-01-09 09:08:35 +0000
commitd1d81d0651360799e238f2653ee3acd5ffd72367 (patch)
tree0f2e7e905f137a326313bd289135a13c0be4d7e0 /synapse/http/matrixfederationclient.py
parentMerge pull request #4361 from matrix-org/erikj/better_errors (diff)
parentNewsfile (diff)
downloadsynapse-d1d81d0651360799e238f2653ee3acd5ffd72367.tar.xz
Merge pull request #4362 from matrix-org/erikj/better_errors
Use RequestSendFailed when fail to parse content type headers
Diffstat (limited to 'synapse/http/matrixfederationclient.py')
-rw-r--r--synapse/http/matrixfederationclient.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py
index 7a2b4f0957..be4076fc6a 100644
--- a/synapse/http/matrixfederationclient.py
+++ b/synapse/http/matrixfederationclient.py
@@ -823,21 +823,21 @@ def check_content_type_is_json(headers):
         headers (twisted.web.http_headers.Headers): headers to check
 
     Raises:
-        RuntimeError if the
+        RequestSendFailed: if the Content-Type header is missing or isn't JSON
 
     """
     c_type = headers.getRawHeaders(b"Content-Type")
     if c_type is None:
-        raise RuntimeError(
+        raise RequestSendFailed(RuntimeError(
             "No Content-Type header"
-        )
+        ), can_retry=False)
 
     c_type = c_type[0].decode('ascii')  # only the first header
     val, options = cgi.parse_header(c_type)
     if val != "application/json":
-        raise RuntimeError(
+        raise RequestSendFailed(RuntimeError(
             "Content-Type not application/json: was '%s'" % c_type
-        )
+        ), can_retry=False)
 
 
 def encode_query_args(args):