# HG changeset patch # User Martin von Zweigbergk # Date 1621399809 25200 # Node ID dd339191f2dccbbc9da8774594f717b1dfe4f880 # Parent 93a0abe098e7576f20db1dfca78b2194e79c23fb errors: make StorageError subclass Error, attaching an exit code to it Differential Revision: https://phab.mercurial-scm.org/D10741 diff -r 93a0abe098e7 -r dd339191f2dc mercurial/error.py --- a/mercurial/error.py Tue May 18 19:33:09 2021 -0700 +++ b/mercurial/error.py Tue May 18 21:50:09 2021 -0700 @@ -91,13 +91,16 @@ """Raised if a command needs to print an error and exit.""" -class StorageError(Hint, Exception): +class StorageError(Error): """Raised when an error occurs in a storage layer. Usually subclassed by a storage-specific exception. """ - __bytes__ = _tobytes + def __init__(self, message, hint=None): + super(StorageError, self).__init__( + message, hint=hint, detailed_exit_code=50 + ) class RevlogError(StorageError): diff -r 93a0abe098e7 -r dd339191f2dc mercurial/scmutil.py --- a/mercurial/scmutil.py Tue May 18 19:33:09 2021 -0700 +++ b/mercurial/scmutil.py Tue May 18 21:50:09 2021 -0700 @@ -198,11 +198,6 @@ ui.error(b"\n%r\n" % pycompat.bytestr(stringutil.ellipsis(msg))) except error.CensoredNodeError as inst: ui.error(_(b"abort: file censored %s\n") % inst) - except error.StorageError as inst: - ui.error(_(b"abort: %s\n") % inst) - if inst.hint: - ui.error(_(b"(%s)\n") % inst.hint) - detailed_exit_code = 50 except error.WdirUnsupported: ui.error(_(b"abort: working directory revision cannot be specified\n")) except error.Error as inst: