bug report

Thomas Arendsen Hein thomas at intevation.de
Tue May 16 02:36:56 CDT 2006


* John Gatewood Ham <zappaman at buraphalinux.org> [20060515 18:54]:
> The hg command crashed and asked me to email this to you.
> 
> httplib.BadStatusLine

I've pushed a patch to crew to make such error messages nicer and
more meaningful.

Thomas

# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID ce67fa312f61d21a1a1686971eb989ce496cf604
# Parent  3dc6f2501dbc03bab8606e06cae1912544679cdc
Catch urllib's HTTPException and give a meaningful error message to the user.
Usually urllib only throws HTTPError exceptions, which already are a subclass
of IOError.

diff -r 3dc6f2501dbc -r ce67fa312f61 mercurial/httprepo.py
--- a/mercurial/httprepo.py	Mon May 15 11:16:32 2006 -0700
+++ b/mercurial/httprepo.py	Tue May 16 09:35:38 2006 +0200
@@ -103,7 +103,10 @@ class httprepository(remoterepository):
         q.update(args)
         qs = urllib.urlencode(q)
         cu = "%s?%s" % (self.url, qs)
-        resp = urllib2.urlopen(cu)
+        try:
+            resp = urllib2.urlopen(cu)
+        except httplib.HTTPException, inst:
+            raise IOError(None, _('http error while sending %s command') % cmd)
         proto = resp.headers['content-type']
 
         # accept old "text/plain" and "application/hg-changegroup" for now

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list