diff mercurial/error.py @ 43402:40bf3d7ecc42 stable

py3: add a __str__ method to Abort This improves the rendering of some exceptions by avoiding raw bytestrings, especially when using --traceback option.
author Denis Laxalde <denis@laxalde.org>
date Mon, 04 Nov 2019 16:13:01 +0100
parents 687b865b95ad
children 822202e72f69
line wrap: on
line diff
--- a/mercurial/error.py	Mon Nov 04 16:04:09 2019 +0100
+++ b/mercurial/error.py	Mon Nov 04 16:13:01 2019 +0100
@@ -111,6 +111,9 @@
 
     __bytes__ = _tobytes
 
+    def __str__(self):
+        return pycompat.sysstr(self.__bytes__())
+
 
 class HookLoadError(Abort):
     """raised when loading a hook fails, aborting an operation