changeset 32665:c032e137e494

py3: convert exception to bytes to pass into ui.warn() Here encoding.strtolocal() is used because exc maybe an IOError which could contain a valid non-ascii unicode.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 02 Jun 2017 10:35:21 +0530
parents 49e1e5acb8ff
children 1df98fc923d4
files mercurial/hook.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Thu Jun 01 02:14:26 2017 +0530
+++ b/mercurial/hook.py	Fri Jun 02 10:35:21 2017 +0530
@@ -13,6 +13,7 @@
 from .i18n import _
 from . import (
     demandimport,
+    encoding,
     error,
     extensions,
     pycompat,
@@ -97,7 +98,7 @@
                          (hname, exc.args[0]))
         else:
             ui.warn(_('error: %s hook raised an exception: '
-                           '%s\n') % (hname, exc))
+                      '%s\n') % (hname, encoding.strtolocal(str(exc))))
         if throw:
             raise
         if not ui.tracebackflag: