mercurial/error.py
changeset 47292 5a75be916316
parent 47291 d9c71bbe20f7
child 47295 dd339191f2dc
equal deleted inserted replaced
47291:d9c71bbe20f7 47292:5a75be916316
    49     def __init__(self, *args, **kw):
    49     def __init__(self, *args, **kw):
    50         self.hint = kw.pop('hint', None)
    50         self.hint = kw.pop('hint', None)
    51         super(Hint, self).__init__(*args, **kw)
    51         super(Hint, self).__init__(*args, **kw)
    52 
    52 
    53 
    53 
    54 class Abort(Hint, Exception):
    54 class Error(Hint, Exception):
    55     """Raised if a command needs to print an error and exit."""
    55     """Base class for Mercurial errors."""
    56 
    56 
    57     def __init__(
    57     def __init__(
    58         self, message, hint=None, coarse_exit_code=None, detailed_exit_code=None
    58         self, message, hint=None, coarse_exit_code=None, detailed_exit_code=None
    59     ):
    59     ):
    60         # type: (bytes, Optional[bytes]) -> None
    60         # type: (bytes, Optional[bytes]) -> None
    83 
    83 
    84         message = _(b"abort: %s\n") % self.message
    84         message = _(b"abort: %s\n") % self.message
    85         if self.hint:
    85         if self.hint:
    86             message += _(b"(%s)\n") % self.hint
    86             message += _(b"(%s)\n") % self.hint
    87         return message
    87         return message
       
    88 
       
    89 
       
    90 class Abort(Error):
       
    91     """Raised if a command needs to print an error and exit."""
    88 
    92 
    89 
    93 
    90 class StorageError(Hint, Exception):
    94 class StorageError(Hint, Exception):
    91     """Raised when an error occurs in a storage layer.
    95     """Raised when an error occurs in a storage layer.
    92 
    96