Mercurial > public > mercurial-scm > hg-stable
diff mercurial/error.py @ 45799:0fc8b066928a
errors: name arguments to ParseError constructor
As with similar previous patches, this is to improve readability.
Differential Revision: https://phab.mercurial-scm.org/D9240
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Oct 2020 09:58:05 -0700 |
parents | 5bb900885311 |
children | 8f07f5a9c3de |
line wrap: on
line diff
--- a/mercurial/error.py Tue Oct 20 08:58:20 2020 -0700 +++ b/mercurial/error.py Thu Oct 22 09:58:05 2020 -0700 @@ -224,6 +224,17 @@ class ParseError(Hint, Exception): """Raised when parsing config files and {rev,file}sets (msg[, pos])""" + def __init__(self, message, location=None, hint=None): + self.message = message + self.location = location + self.hint = hint + # Pass the message and possibly location into the Exception constructor + # to help code that looks for exc.args. + if location is not None: + Exception.__init__(self, message, location) + else: + Exception.__init__(self, message) + __bytes__ = _tobytes