From: Brandon King Date: Sat, 10 Nov 2007 01:20:19 +0000 (+0000) Subject: [project @ Updated to give more user friendly error:] X-Git-Tag: 0.1.0~80 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=c2a28fca4b4e916d2634946258bf7cfa39da4929 [project @ Updated to give more user friendly error:] * Gives a more user friendly error when connection is refused. * FIXME: Should include other errors as well, such as host lookup errors. --- diff --git a/bin/retrieve_eland_config.py b/bin/retrieve_eland_config.py index cfd77f1..7cb116b 100644 --- a/bin/retrieve_eland_config.py +++ b/bin/retrieve_eland_config.py @@ -92,9 +92,11 @@ def getCombinedOptions(): if conf_parser.has_option('server_info', 'base_host_url'): options.url = conf_parser.get('server_info', 'base_host_url') - print 'URL:', options.url - print 'OUT:', options.output_filepath - print ' FC:', options.flowcell + print 'USING OPTIONS:' + print ' URL:', options.url + print ' OUT:', options.output_filepath + print ' FC:', options.flowcell + print '' return options @@ -107,7 +109,16 @@ def saveConfigFile(flowcell, base_host_url, output_filepath): url = base_host_url + '/elandifier/config/%s/' % (flowcell) f = open(output_filepath, 'w') - web = urllib.urlopen(url) + try: + web = urllib.urlopen(url) + except IOError, msg: + if str(msg).find("Connection refused") >= 0: + print 'Error: Could not connect to: %s' % (url) + f.close() + sys.exit(1) + else: + raise IOError, msg + f.write(web.read()) web.close() f.close()