Catch urllib errors for old-http in a nicer way.
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 01 Mar 2006 15:29:13 +0100
changeset 1821 0b3f4be5c5bf
parent 1820 7e10518b2b9e
child 1824 dca000ef7d52
Catch urllib errors for old-http in a nicer way.
mercurial/statichttprepo.py
tests/test-static-http.out
--- 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