D4654: error: introduce StorageError

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Sep 24 11:57:02 EDT 2018


indygreg added a comment.


  In https://phab.mercurial-scm.org/D4654#71289, @yuja wrote:
  
  > > -class RevlogError(Hint, Exception):
  > >  +class StorageError(Hint, Exception):
  > >  +    """Raised when an error occurs in a storage layer.
  > >  +
  > >  +    Usually subclassed by a storage-specific exception.
  > >  +    """
  > >  +    __bytes__ = _tobytes
  > >  +
  > >  +class RevlogError(StorageError):
  > > 
  > >   __bytes__ = _tobytes
  >
  > Perhaps `LookupError` will have to be either reparented to `StorageError`
  >  or detached from the storage-type error. Just a note. I think you would have
  >  some plan.
  
  
  I, uh, missed that `LookupError` inherited from `RevlogError`. I think it should inherit from `StorageError` directly.
  
  Ideally, I think it shouldn't be part of `StorageError`. But I suspect a number of `except StorageError` will need updated to consider that. I'm not willing to scope bloat that work... yet.
  
  I attempted the trivial reparenting to `StorageError` and this broke a test:
  
    --- /home/gps/src/hg/tests/test-revset.t
    +++ /home/gps/src/hg/tests/test-revset.t.err
    @@ -1941,7 +1941,7 @@
       2:fffb6093b00943f91034b9bdad069402c834e572 fffb6
       3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4
       4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8
    -  2147483647:ffffffffffffffffffffffffffffffffffffffff fffff
    +  2147483647:ffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffff
       $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571
       obsoleted 1 changesets
  
  Why, I'm not exactly sure. Perhaps an overzealous `except RevlogError` in revlog.py somewhere? I may track this down and fix it...

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4654

To: indygreg, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list