mercurial/error.py
changeset 25248 821e664924dc
parent 25242 8de7d1d937b3
child 25249 4311e78a4609
equal deleted inserted replaced
25247:f2b98dacb37d 25248:821e664924dc
    10 This allows us to catch exceptions at higher levels without forcing
    10 This allows us to catch exceptions at higher levels without forcing
    11 imports.
    11 imports.
    12 """
    12 """
    13 
    13 
    14 # Do not import anything here, please
    14 # Do not import anything here, please
       
    15 
       
    16 class HintException(Exception):
       
    17     def __init__(self, *args, **kw):
       
    18         Exception.__init__(self, *args)
       
    19         self.hint = kw.get('hint')
    15 
    20 
    16 class RevlogError(Exception):
    21 class RevlogError(Exception):
    17     pass
    22     pass
    18 
    23 
    19 class FilteredIndexError(IndexError):
    24 class FilteredIndexError(IndexError):
    44     """Exception raised on errors in parsing the command line."""
    49     """Exception raised on errors in parsing the command line."""
    45 
    50 
    46 class InterventionRequired(Exception):
    51 class InterventionRequired(Exception):
    47     """Exception raised when a command requires human intervention."""
    52     """Exception raised when a command requires human intervention."""
    48 
    53 
    49 class Abort(Exception):
    54 class Abort(HintException):
    50     """Raised if a command needs to print an error and exit."""
    55     """Raised if a command needs to print an error and exit."""
    51     def __init__(self, *args, **kw):
    56     pass
    52         Exception.__init__(self, *args)
       
    53         self.hint = kw.get('hint')
       
    54 
    57 
    55 class HookAbort(Abort):
    58 class HookAbort(Abort):
    56     """raised when a validation hook fails, aborting an operation
    59     """raised when a validation hook fails, aborting an operation
    57 
    60 
    58     Exists to allow more specialized catching."""
    61     Exists to allow more specialized catching."""
    78         from i18n import _
    81         from i18n import _
    79         ParseError.__init__(self, _("unknown identifier: %s") % function)
    82         ParseError.__init__(self, _("unknown identifier: %s") % function)
    80         self.function = function
    83         self.function = function
    81         self.symbols = symbols
    84         self.symbols = symbols
    82 
    85 
    83 class RepoError(Exception):
    86 class RepoError(HintException):
    84     def __init__(self, *args, **kw):
    87     pass
    85         Exception.__init__(self, *args)
       
    86         self.hint = kw.get('hint')
       
    87 
    88 
    88 class RepoLookupError(RepoError):
    89 class RepoLookupError(RepoError):
    89     pass
    90     pass
    90 
    91 
    91 class FilteredRepoLookupError(RepoLookupError):
    92 class FilteredRepoLookupError(RepoLookupError):