Mercurial > hg-stable
changeset 2294:ce67fa312f61
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.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 16 May 2006 09:35:38 +0200 |
parents | 3dc6f2501dbc |
children | 9c15f85e61b1 |
files | mercurial/httprepo.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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