comparison mercurial/error.py @ 47306:dd339191f2dc

errors: make StorageError subclass Error, attaching an exit code to it Differential Revision: https://phab.mercurial-scm.org/D10741
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 18 May 2021 21:50:09 -0700
parents 5a75be916316
children 73f52278a158
comparison
equal deleted inserted replaced
47305:93a0abe098e7 47306:dd339191f2dc
89 89
90 class Abort(Error): 90 class Abort(Error):
91 """Raised if a command needs to print an error and exit.""" 91 """Raised if a command needs to print an error and exit."""
92 92
93 93
94 class StorageError(Hint, Exception): 94 class StorageError(Error):
95 """Raised when an error occurs in a storage layer. 95 """Raised when an error occurs in a storage layer.
96 96
97 Usually subclassed by a storage-specific exception. 97 Usually subclassed by a storage-specific exception.
98 """ 98 """
99 99
100 __bytes__ = _tobytes 100 def __init__(self, message, hint=None):
101 super(StorageError, self).__init__(
102 message, hint=hint, detailed_exit_code=50
103 )
101 104
102 105
103 class RevlogError(StorageError): 106 class RevlogError(StorageError):
104 pass 107 pass
105 108