changeset 4999:a9457b9aca4e stable

py3: fix several TypeError formatting bytes with an exception object
author Denis Laxalde <denis.laxalde@logilab.fr>
date Tue, 10 Dec 2019 20:35:56 +0100
parents 88b816a9d990
children 8d38ad9c044f cb78c6efbbdb
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py	Fri Oct 11 21:32:27 2019 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue Dec 10 20:35:56 2019 +0100
@@ -33,6 +33,7 @@
     util,
 )
 from mercurial.i18n import _
+from mercurial.utils import stringutil
 
 from . import (
     compat,
@@ -447,7 +448,9 @@
                             for r in ranges:
                                 self._data.pop(r, None)
                     except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc:
-                        repo.ui.log(b'evoext-cache', b'error while updating obshashrange cache: %s' % exc)
+                        repo.ui.log(b'evoext-cache',
+                                    b'error while updating obshashrange cache: %s'
+                                    % stringutil.forcebytestr(exc))
                         del self._updating
                         return
 
@@ -551,8 +554,11 @@
             if r'_con' in vars(self):
                 del self._con
             self._new.clear()
-            repo.ui.log(b'evoext-cache', b'error while saving new data: %s' % exc)
-            repo.ui.debug(b'evoext-cache: error while saving new data: %s' % exc)
+            repo.ui.log(b'evoext-cache',
+                        b'error while saving new data: %s'
+                        % stringutil.forcebytestr(exc))
+            repo.ui.debug(b'evoext-cache: error while saving new data: %s'
+                          % stringutil.forcebytestr(exc))
 
     def _trysave(self, repo):
         if self._con is None: