summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-03 13:51:10 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-03 13:51:17 +0100
commitb1195c125fe6ff7e14743c6984623cbdcfad780a (patch)
tree65995562b6b19faf881039315575033d23243d1b /synapse
parentImplement presence state visibilty limiting when polling eventsource for stream (diff)
downloadsynapse-b1195c125fe6ff7e14743c6984623cbdcfad780a.tar.xz
hs: Updated synapse.http.client to handle DNSLookupErrors and bail immediately.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/http/client.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 093bdf0e3f..709c952226 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -15,6 +15,7 @@
 
 
 from twisted.internet import defer, reactor
+from twisted.internet.error import DNSLookupError
 from twisted.web.client import _AgentBase, _URI, readBody
 from twisted.web.http_headers import Headers
 
@@ -23,7 +24,7 @@ from synapse.util.async import sleep
 
 from syutil.jsonutil import encode_canonical_json
 
-from synapse.api.errors import CodeMessageException
+from synapse.api.errors import CodeMessageException, SynapseError
 
 import json
 import logging
@@ -198,6 +199,10 @@ class TwistedHttpClient(HttpClient):
 
                 logger.debug("Got response to %s", method)
                 break
+            except DNSLookupError as dns:
+                logger.warn("DNS Lookup failed to %s with %s", destination,
+                            dns)
+                raise SynapseError(400, "Domain specified not found.")
             except Exception as e:
                 logger.exception("Got error in _create_request")
                 _print_ex(e)