mercurial/keepalive.py
changeset 34308 9bd003052d55
parent 32668 d7626e85dada
child 34331 531332502568
--- 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)