Mercurial > public > mercurial-scm > hg-stable
diff mercurial/keepalive.py @ 34315:9bd003052d55
keepalive: add more context to bad status line errors
As the TODO in the test said, the previous error message was not
very helpful. Let's improve things.
Differential Revision: https://phab.mercurial-scm.org/D811
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 25 Sep 2017 11:05:16 +0200 |
parents | d7626e85dada |
children | 531332502568 |
line wrap: on
line diff
--- a/mercurial/keepalive.py Fri Aug 18 20:20:38 2017 -0700 +++ b/mercurial/keepalive.py Mon Sep 25 11:05:16 2017 +0200 @@ -90,6 +90,7 @@ import sys import threading +from .i18n import _ from . import ( util, ) @@ -231,6 +232,10 @@ self._cm.add(host, h, 0) self._start_transaction(h, req) r = h.getresponse() + # The string form of BadStatusLine is the status line. Add some context + # to make the error message slightly more useful. + except httplib.BadStatusLine as err: + raise urlerr.urlerror(_('bad HTTP status line: %s') % err.line) except (socket.error, httplib.HTTPException) as err: raise urlerr.urlerror(err)