py3: fix fsmonitor's _watchmantofsencoding exception message encoding stable
authorEmmanuel Leblond <emmanuel.leblond@gmail.com>
Fri, 01 Nov 2019 11:02:47 -0700
branchstable
changeset 43374 65c37b431e76
parent 43373 de2c8722a787
child 43375 c2c3ee8794dd
py3: fix fsmonitor's _watchmantofsencoding exception message encoding Differential Revision: https://phab.mercurial-scm.org/D7190
hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py	Thu Oct 31 15:03:12 2019 -0700
+++ b/hgext/fsmonitor/__init__.py	Fri Nov 01 11:02:47 2019 -0700
@@ -246,12 +246,14 @@
     try:
         decoded = path.decode(_watchmanencoding)
     except UnicodeDecodeError as e:
-        raise error.Abort(str(e), hint=b'watchman encoding error')
+        raise error.Abort(
+            stringutil.forcebytestr(e), hint=b'watchman encoding error'
+        )
 
     try:
         encoded = decoded.encode(_fsencoding, 'strict')
     except UnicodeEncodeError as e:
-        raise error.Abort(str(e))
+        raise error.Abort(stringutil.forcebytestr(e))
 
     return encoded