diff mercurial/error.py @ 45682:d2e1dcd4490d

errors: name arguments to Abort constructor Differential Revision: https://phab.mercurial-scm.org/D9179
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 08 Oct 2020 13:37:31 -0700
parents bb1a988ef4a5
children 5bb900885311
line wrap: on
line diff
--- a/mercurial/error.py	Thu Oct 08 15:35:44 2020 -0700
+++ b/mercurial/error.py	Thu Oct 08 13:37:31 2020 -0700
@@ -155,7 +155,15 @@
 class Abort(Hint, Exception):
     """Raised if a command needs to print an error and exit."""
 
-    __bytes__ = _tobytes
+    def __init__(self, message, hint=None):
+        self.message = message
+        self.hint = hint
+        # Pass the message into the Exception constructor to help extensions
+        # that look for exc.args[0].
+        Exception.__init__(self, message)
+
+    def __bytes__(self):
+        return self.message
 
     if pycompat.ispy3: