Show More
@@ -15,12 +15,17 b' from __future__ import absolute_import' | |||||
15 |
|
15 | |||
16 | # Do not import anything here, please |
|
16 | # Do not import anything here, please | |
17 |
|
17 | |||
18 | class HintException(Exception): |
|
18 | class Hint(object): | |
|
19 | """Mix-in to provide a hint of an error | |||
|
20 | ||||
|
21 | This should come first in the inheritance list to consume **kw and pass | |||
|
22 | only *args to the exception class. | |||
|
23 | """ | |||
19 | def __init__(self, *args, **kw): |
|
24 | def __init__(self, *args, **kw): | |
20 |
|
|
25 | super(Hint, self).__init__(*args) | |
21 | self.hint = kw.get('hint') |
|
26 | self.hint = kw.get('hint') | |
22 |
|
27 | |||
23 | class RevlogError(HintException): |
|
28 | class RevlogError(Hint, Exception): | |
24 | pass |
|
29 | pass | |
25 |
|
30 | |||
26 | class FilteredIndexError(IndexError): |
|
31 | class FilteredIndexError(IndexError): | |
@@ -50,10 +55,10 b' class ManifestLookupError(LookupError):' | |||||
50 | class CommandError(Exception): |
|
55 | class CommandError(Exception): | |
51 | """Exception raised on errors in parsing the command line.""" |
|
56 | """Exception raised on errors in parsing the command line.""" | |
52 |
|
57 | |||
53 | class InterventionRequired(HintException): |
|
58 | class InterventionRequired(Hint, Exception): | |
54 | """Exception raised when a command requires human intervention.""" |
|
59 | """Exception raised when a command requires human intervention.""" | |
55 |
|
60 | |||
56 | class Abort(HintException): |
|
61 | class Abort(Hint, Exception): | |
57 | """Raised if a command needs to print an error and exit.""" |
|
62 | """Raised if a command needs to print an error and exit.""" | |
58 |
|
63 | |||
59 | class HookLoadError(Abort): |
|
64 | class HookLoadError(Abort): | |
@@ -87,10 +92,10 b' class ResponseExpected(Abort):' | |||||
87 | from .i18n import _ |
|
92 | from .i18n import _ | |
88 | Abort.__init__(self, _('response expected')) |
|
93 | Abort.__init__(self, _('response expected')) | |
89 |
|
94 | |||
90 | class OutOfBandError(HintException): |
|
95 | class OutOfBandError(Hint, Exception): | |
91 | """Exception raised when a remote repo reports failure""" |
|
96 | """Exception raised when a remote repo reports failure""" | |
92 |
|
97 | |||
93 | class ParseError(HintException): |
|
98 | class ParseError(Hint, Exception): | |
94 | """Raised when parsing config files and {rev,file}sets (msg[, pos])""" |
|
99 | """Raised when parsing config files and {rev,file}sets (msg[, pos])""" | |
95 |
|
100 | |||
96 | class UnknownIdentifier(ParseError): |
|
101 | class UnknownIdentifier(ParseError): | |
@@ -102,7 +107,7 b' class UnknownIdentifier(ParseError):' | |||||
102 | self.function = function |
|
107 | self.function = function | |
103 | self.symbols = symbols |
|
108 | self.symbols = symbols | |
104 |
|
109 | |||
105 | class RepoError(HintException): |
|
110 | class RepoError(Hint, Exception): | |
106 | pass |
|
111 | pass | |
107 |
|
112 | |||
108 | class RepoLookupError(RepoError): |
|
113 | class RepoLookupError(RepoError): |
General Comments 0
You need to be logged in to leave comments.
Login now