Mercurial > hg
comparison mercurial/error.py @ 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 | b17a6e3cd2ac |
comparison
equal
deleted
inserted
replaced
29509:945b4c14c570 | 29510:19205a0e2bf1 |
---|---|
16 # Do not import anything here, please | 16 # Do not import anything here, please |
17 | 17 |
18 class Hint(object): | 18 class Hint(object): |
19 """Mix-in to provide a hint of an error | 19 """Mix-in to provide a hint of an error |
20 | 20 |
21 This should come first in the inheritance list to consume **kw and pass | 21 This should come first in the inheritance list to consume a hint and |
22 only *args to the exception class. | 22 pass remaining arguments to the exception class. |
23 """ | 23 """ |
24 def __init__(self, *args, **kw): | 24 def __init__(self, *args, **kw): |
25 super(Hint, self).__init__(*args) | 25 self.hint = kw.pop('hint', None) |
26 self.hint = kw.get('hint') | 26 super(Hint, self).__init__(*args, **kw) |
27 | 27 |
28 class RevlogError(Hint, Exception): | 28 class RevlogError(Hint, Exception): |
29 pass | 29 pass |
30 | 30 |
31 class FilteredIndexError(IndexError): | 31 class FilteredIndexError(IndexError): |