changeset 1821:0b3f4be5c5bf

Catch urllib errors for old-http in a nicer way.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 01 Mar 2006 15:29:13 +0100
parents 7e10518b2b9e
children dca000ef7d52
files mercurial/statichttprepo.py tests/test-static-http.out
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statichttprepo.py	Wed Mar 01 14:52:28 2006 +0100
+++ b/mercurial/statichttprepo.py	Wed Mar 01 15:29:13 2006 +0100
@@ -15,8 +15,10 @@
     def read(self, size=None):
         try:
             return httprangereader.httprangereader.read(self, size)
+        except urllib2.HTTPError, inst:
+            raise IOError(None, inst)
         except urllib2.URLError, inst:
-            raise IOError(None, str(inst))
+            raise IOError(None, inst.reason[1])
 
 def opener(base):
     """return a function that opens files over http"""
--- a/tests/test-static-http.out	Wed Mar 01 14:52:28 2006 +0100
+++ b/tests/test-static-http.out	Wed Mar 01 15:29:13 2006 +0100
@@ -1,4 +1,4 @@
-abort: <urlopen error (111, 'Connection refused')>
+abort: Connection refused
 255
 ls: copy: No such file or directory
 changeset:   0:61c9426e69fe