Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
45681:a736ab681b78 | 45682:d2e1dcd4490d |
---|---|
153 | 153 |
154 | 154 |
155 class Abort(Hint, Exception): | 155 class Abort(Hint, Exception): |
156 """Raised if a command needs to print an error and exit.""" | 156 """Raised if a command needs to print an error and exit.""" |
157 | 157 |
158 __bytes__ = _tobytes | 158 def __init__(self, message, hint=None): |
159 self.message = message | |
160 self.hint = hint | |
161 # Pass the message into the Exception constructor to help extensions | |
162 # that look for exc.args[0]. | |
163 Exception.__init__(self, message) | |
164 | |
165 def __bytes__(self): | |
166 return self.message | |
159 | 167 |
160 if pycompat.ispy3: | 168 if pycompat.ispy3: |
161 | 169 |
162 def __str__(self): | 170 def __str__(self): |
163 # the output would be unreadable if the message was translated, | 171 # the output would be unreadable if the message was translated, |