From 2ded2634bd090dacf54effe51566cd3ab8c3aeaa Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 26 Jan 2016 14:13:42 +0100 Subject: [PATCH 1/1] try to get nicer exception messages when we fail fetching the checkip URL --- client-scripts/dyn-ns-client | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client-scripts/dyn-ns-client b/client-scripts/dyn-ns-client index 175d880..0e96bed 100755 --- a/client-scripts/dyn-ns-client +++ b/client-scripts/dyn-ns-client @@ -63,7 +63,11 @@ def getMyIP(family, config, methods = {}, verbose = 0): return None elif method == 'web': server = config[family].get('server', config['DEFAULT']['server']) - ip = urlopen('https://'+server+'/checkip', config) + url = 'https://'+server+'/checkip' + try: + ip = urlopen(url, config) + except urllib.error.URLError: + raise Exception("Error fetching {}, make sure the URL is correct and the internet connection actually works.".format(url)) if verbose >= VERBOSE_FULL: print("Server",server,"says my",family,"is",ip) return ip -- 2.30.2