##// END OF EJS Templates
errors: make StorageError subclass Error, attaching an exit code to it...
Martin von Zweigbergk -
r48075:dd339191 default
parent child Browse files
Show More
@@ -91,13 +91,16 b' 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):
@@ -198,11 +198,6 b' def callcatch(ui, func):'
198 ui.error(b"\n%r\n" % pycompat.bytestr(stringutil.ellipsis(msg)))
198 ui.error(b"\n%r\n" % pycompat.bytestr(stringutil.ellipsis(msg)))
199 except error.CensoredNodeError as inst:
199 except error.CensoredNodeError as inst:
200 ui.error(_(b"abort: file censored %s\n") % inst)
200 ui.error(_(b"abort: file censored %s\n") % inst)
201 except error.StorageError as inst:
202 ui.error(_(b"abort: %s\n") % inst)
203 if inst.hint:
204 ui.error(_(b"(%s)\n") % inst.hint)
205 detailed_exit_code = 50
206 except error.WdirUnsupported:
201 except error.WdirUnsupported:
207 ui.error(_(b"abort: working directory revision cannot be specified\n"))
202 ui.error(_(b"abort: working directory revision cannot be specified\n"))
208 except error.Error as inst:
203 except error.Error as inst:
General Comments 0
You need to be logged in to leave comments. Login now