comparison mercurial/error.py @ 45885:600aec73f309

errors: format "abort: " text in a new Abort.format() method This remove some duplication we had. Differential Revision: https://phab.mercurial-scm.org/D9348
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 20 Nov 2020 09:17:38 -0800
parents 98399dd1b96c
children 7eb221b9af6c
comparison
equal deleted inserted replaced
45884:98399dd1b96c 45885:600aec73f309
179 def __str__(self): 179 def __str__(self):
180 # the output would be unreadable if the message was translated, 180 # the output would be unreadable if the message was translated,
181 # but do not replace it with encoding.strfromlocal(), which 181 # but do not replace it with encoding.strfromlocal(), which
182 # may raise another exception. 182 # may raise another exception.
183 return pycompat.sysstr(self.__bytes__()) 183 return pycompat.sysstr(self.__bytes__())
184
185 def format(self):
186 from .i18n import _
187
188 message = _(b"abort: %s\n") % self.message
189 if self.hint:
190 message += _(b"(%s)\n") % self.hint
191 return message
184 192
185 193
186 class InputError(Abort): 194 class InputError(Abort):
187 """Indicates that the user made an error in their input. 195 """Indicates that the user made an error in their input.
188 196