Mercurial > hg
changeset 46976:f9482db16cef
errors: introduce a class for remote errors
Having an exception for remote errors makes it much easier to exit
with the right detailed exit code.
Differential Revision: https://phab.mercurial-scm.org/D10466
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 19 Apr 2021 09:37:01 -0700 |
parents | 14ddb1dca2c0 |
children | 3f87d2af0bd6 |
files | mercurial/error.py mercurial/scmutil.py |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/error.py Mon Apr 19 10:49:15 2021 -0700 +++ b/mercurial/error.py Mon Apr 19 09:37:01 2021 -0700 @@ -304,7 +304,11 @@ Abort.__init__(self, _(b'response expected')) -class OutOfBandError(Abort): +class RemoteError(Abort): + """Exception raised when interacting with a remote repo fails""" + + +class OutOfBandError(RemoteError): """Exception raised when a remote repo reports failure""" def __init__(self, *messages, **kwargs):
--- a/mercurial/scmutil.py Mon Apr 19 10:49:15 2021 -0700 +++ b/mercurial/scmutil.py Mon Apr 19 09:37:01 2021 -0700 @@ -222,7 +222,7 @@ detailed_exit_code = 30 elif isinstance(inst, error.HookAbort): detailed_exit_code = 40 - elif isinstance(inst, error.OutOfBandError): + elif isinstance(inst, error.RemoteError): detailed_exit_code = 100 elif isinstance(inst, error.SecurityError): detailed_exit_code = 150