Mercurial > hg-stable
changeset 29510:19205a0e2bf1
error: make hintable exceptions reject unknown keyword arguments (API)
Previously they would accept any typos of the hint keyword.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 11 Jul 2016 21:40:02 +0900 |
parents | 945b4c14c570 |
children | 540c01a18bb7 |
files | mercurial/error.py mercurial/subrepo.py |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/error.py Sat Jul 09 14:28:30 2016 +0900 +++ b/mercurial/error.py Mon Jul 11 21:40:02 2016 +0900 @@ -18,12 +18,12 @@ class Hint(object): """Mix-in to provide a hint of an error - This should come first in the inheritance list to consume **kw and pass - only *args to the exception class. + This should come first in the inheritance list to consume a hint and + pass remaining arguments to the exception class. """ def __init__(self, *args, **kw): - super(Hint, self).__init__(*args) - self.hint = kw.get('hint') + self.hint = kw.pop('hint', None) + super(Hint, self).__init__(*args, **kw) class RevlogError(Hint, Exception): pass
--- a/mercurial/subrepo.py Sat Jul 09 14:28:30 2016 +0900 +++ b/mercurial/subrepo.py Mon Jul 11 21:40:02 2016 +0900 @@ -56,9 +56,9 @@ class SubrepoAbort(error.Abort): """Exception class used to avoid handling a subrepo error more than once""" def __init__(self, *args, **kw): + self.subrepo = kw.pop('subrepo', None) + self.cause = kw.pop('cause', None) error.Abort.__init__(self, *args, **kw) - self.subrepo = kw.get('subrepo') - self.cause = kw.get('cause') def annotatesubrepoerror(func): def decoratedmethod(self, *args, **kargs):