Correctly handle all the places that can throw exceptions

This commit is contained in:
Erik Johnston 2015-02-12 18:17:11 +00:00
parent 92d850fc87
commit 963256638d
4 changed files with 36 additions and 14 deletions

View file

@ -97,8 +97,11 @@ def lookup(destination, path):
if ":" in destination:
return "https://%s%s" % (destination, path)
else:
srv = srvlookup.lookup("matrix", "tcp", destination)[0]
return "https://%s:%d%s" % (srv.host, srv.port, path)
try:
srv = srvlookup.lookup("matrix", "tcp", destination)[0]
return "https://%s:%d%s" % (srv.host, srv.port, path)
except:
return "https://%s:%d%s" % (destination, 8448, path)
def get_json(origin_name, origin_key, destination, path):
request_json = {