diff hgext/fsmonitor/__init__.py @ 43374:65c37b431e76 stable

py3: fix fsmonitor's _watchmantofsencoding exception message encoding Differential Revision: https://phab.mercurial-scm.org/D7190
author Emmanuel Leblond <emmanuel.leblond@gmail.com>
date Fri, 01 Nov 2019 11:02:47 -0700
parents ddfd0f3956f4
children e6ce1599af74
line wrap: on
line diff
--- 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