Mercurial > hg
comparison mercurial/error.py @ 39776:cb65d4b7e429
error: introduce StorageError
Errors in revlogs are often represented by RevlogError. It's fine
for revlogs to raise a revlog-specific exception. But in the context
of multiple storage backends, it doesn't make sense to be throwing or
catching an exception with "revlog" in its name when revlogs may not
even be in play.
This commit introduces a new generic StorageError type for representing
errors in the storage layer.
RevlogError is an instance of this type.
Interface documentation and tests referencing RevlogError has been
updated to specify StorageError should be used.
.. api::
``error.StorageError`` has been introduced to represent errors in
storage. It should be used in place of ``error.RevlogError`` unless
the error is known to come from a revlog.
Differential Revision: https://phab.mercurial-scm.org/D4654
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 18 Sep 2018 16:45:13 -0700 |
parents | 409c42d6a570 |
children | b63dee7bd0d9 |
comparison
equal
deleted
inserted
replaced
39775:974592474dee | 39776:cb65d4b7e429 |
---|---|
32 """ | 32 """ |
33 def __init__(self, *args, **kw): | 33 def __init__(self, *args, **kw): |
34 self.hint = kw.pop(r'hint', None) | 34 self.hint = kw.pop(r'hint', None) |
35 super(Hint, self).__init__(*args, **kw) | 35 super(Hint, self).__init__(*args, **kw) |
36 | 36 |
37 class RevlogError(Hint, Exception): | 37 class StorageError(Hint, Exception): |
38 """Raised when an error occurs in a storage layer. | |
39 | |
40 Usually subclassed by a storage-specific exception. | |
41 """ | |
42 __bytes__ = _tobytes | |
43 | |
44 class RevlogError(StorageError): | |
38 __bytes__ = _tobytes | 45 __bytes__ = _tobytes |
39 | 46 |
40 class FilteredIndexError(IndexError): | 47 class FilteredIndexError(IndexError): |
41 __bytes__ = _tobytes | 48 __bytes__ = _tobytes |
42 | 49 |