sslutil: some more forcebytes() on some exception messages
authorAugie Fackler <augie@google.com>
Sun, 04 Mar 2018 21:16:36 -0500
changeset 36747 4c71a26a4009
parent 36746 25798cf7dc9d
child 36760 7bf80d9d9543
sslutil: some more forcebytes() on some exception messages At this point, test-https.t no longer dumps tracebacks everywhere. Instead, we get some results that look like we're not adequately finding things in hg's configuration, which should be manageable (if somewhat annoying to find and fix.) Differential Revision: https://phab.mercurial-scm.org/D2690
mercurial/sslutil.py
--- a/mercurial/sslutil.py	Sun Mar 04 21:15:37 2018 -0500
+++ b/mercurial/sslutil.py	Sun Mar 04 21:16:36 2018 -0500
@@ -346,10 +346,11 @@
 
     for f in (keyfile, certfile):
         if f and not os.path.exists(f):
-            raise error.Abort(_('certificate file (%s) does not exist; '
-                                'cannot connect to %s') % (f, serverhostname),
-                              hint=_('restore missing file or fix references '
-                                     'in Mercurial config'))
+            raise error.Abort(
+                _('certificate file (%s) does not exist; cannot connect to %s')
+                % (f, pycompat.bytesurl(serverhostname)),
+                hint=_('restore missing file or fix references '
+                       'in Mercurial config'))
 
     settings = _hostsettings(ui, serverhostname)
 
@@ -372,9 +373,10 @@
         try:
             sslcontext.set_ciphers(pycompat.sysstr(settings['ciphers']))
         except ssl.SSLError as e:
-            raise error.Abort(_('could not set ciphers: %s') % e.args[0],
-                              hint=_('change cipher string (%s) in config') %
-                                   settings['ciphers'])
+            raise error.Abort(
+                _('could not set ciphers: %s') % util.forcebytestr(e.args[0]),
+                hint=_('change cipher string (%s) in config') %
+                settings['ciphers'])
 
     if certfile is not None:
         def password():