From: Zac Medico Date: Tue, 27 Nov 2007 01:13:20 +0000 (-0000) Subject: Bug #200231 - Make dir_get_metadata() handle an exception thrown X-Git-Tag: v2.1.4~193 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4ea80a0241e6b6ceac36cf8d92602befa6713fd7;p=portage.git Bug #200231 - Make dir_get_metadata() handle an exception thrown from dir_get_list() when there's a problem connection problem. (trunk r8702) svn path=/main/branches/2.1.2/; revision=8703 --- diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py index b57da2ca1..d20a549ed 100644 --- a/pym/getbinpkg.py +++ b/pym/getbinpkg.py @@ -307,7 +307,9 @@ def dir_get_list(baseurl,conn=None): del page listing = parser.get_anchors() else: - raise Exception, "Unable to get listing: %s %s" % (rc,msg) + import portage_exception + raise portage_exception.PortageException( + "Unable to get listing: %s %s" % (rc,msg)) elif protocol in ["ftp"]: if address[-1] == '/': olddir = conn.pwd() @@ -489,7 +491,14 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= sys.stderr.write("!!! Permission denied: '%s'\n" % cache_path) return metadata[baseurl]["data"] - filelist = dir_get_list(baseurl, conn) + import portage_exception + try: + filelist = dir_get_list(baseurl, conn) + except portage_exception.PortageException, e: + sys.stderr.write("!!! Error connecting to '%s'.\n" % baseurl) + sys.stderr.write("!!! %s\n" % str(e)) + del e + return metadata[baseurl]["data"] tbz2list = match_in_array(filelist, suffix=".tbz2") metalist = match_in_array(filelist, prefix="metadata.idx") del filelist