Mercurial > hg
diff mercurial/util.py @ 39777:b63dee7bd0d9
global: replace most uses of RevlogError with StorageError (API)
When catching errors in storage, we should be catching
StorageError instead of RevlogError. When throwing errors related
to storage, we shouldn't be using RevlogError unless we know
the error stemmed from revlogs. And we only reliably know that
if we're in revlog.py or are inheriting from a type defined in
revlog.py.
Differential Revision: https://phab.mercurial-scm.org/D4655
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 18 Sep 2018 16:47:09 -0700 |
parents | 8f2c0d1b454c |
children | 5fe0b880200e |
line wrap: on
line diff
--- a/mercurial/util.py Tue Sep 18 16:45:13 2018 -0700 +++ b/mercurial/util.py Tue Sep 18 16:47:09 2018 -0700 @@ -3448,7 +3448,7 @@ The object has a ``decompress(data)`` method that decompresses data. The method will only be called if ``data`` begins with ``revlogheader()``. The method should return the raw, uncompressed - data or raise a ``RevlogError``. + data or raise a ``StorageError``. The object is reusable but is not thread safe. """ @@ -3626,8 +3626,8 @@ try: return zlib.decompress(data) except zlib.error as e: - raise error.RevlogError(_('revlog decompress error: %s') % - stringutil.forcebytestr(e)) + raise error.StorageError(_('revlog decompress error: %s') % + stringutil.forcebytestr(e)) def revlogcompressor(self, opts=None): return self.zlibrevlogcompressor() @@ -3838,8 +3838,8 @@ return ''.join(chunks) except Exception as e: - raise error.RevlogError(_('revlog decompress error: %s') % - stringutil.forcebytestr(e)) + raise error.StorageError(_('revlog decompress error: %s') % + stringutil.forcebytestr(e)) def revlogcompressor(self, opts=None): opts = opts or {}