Mercurial > hg
comparison mercurial/error.py @ 45884:98399dd1b96c
errors: make formatparse() an instance method on ParseError
It's just a little simpler this way.
Don't ask me what the "hg: " prefix signifies to the user, I just left
it as it was. I think we should consider changing the prefixes later
(maybe always use "abort: ", or maybe use more specific prefixes in
general).
Differential Revision: https://phab.mercurial-scm.org/D9347
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 20 Nov 2020 08:51:45 -0800 |
parents | 1817b66897ad |
children | 600aec73f309 |
comparison
equal
deleted
inserted
replaced
45883:1817b66897ad | 45884:98399dd1b96c |
---|---|
264 Exception.__init__(self, message, location) | 264 Exception.__init__(self, message, location) |
265 else: | 265 else: |
266 Exception.__init__(self, message) | 266 Exception.__init__(self, message) |
267 | 267 |
268 __bytes__ = _tobytes | 268 __bytes__ = _tobytes |
269 | |
270 def format(self): | |
271 from .i18n import _ | |
272 | |
273 if self.location is not None: | |
274 message = _(b"hg: parse error at %s: %s\n") % ( | |
275 pycompat.bytestr(self.location), | |
276 self.message, | |
277 ) | |
278 else: | |
279 message = _(b"hg: parse error: %s\n") % self.message | |
280 if self.hint: | |
281 message += _(b"(%s)\n") % self.hint | |
282 return message | |
269 | 283 |
270 | 284 |
271 class PatchError(Exception): | 285 class PatchError(Exception): |
272 __bytes__ = _tobytes | 286 __bytes__ = _tobytes |
273 | 287 |