# HG changeset patch # User Martin von Zweigbergk <martinvonz@google.com> # Date 2021-04-19 16:37:01 # Node ID f9482db16cef127a7900b67e8d160263373855af # Parent 14ddb1dca2c012da0f753caacee4ed48b8afd954 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 diff --git a/mercurial/error.py b/mercurial/error.py --- a/mercurial/error.py +++ b/mercurial/error.py @@ -304,7 +304,11 @@ class ResponseExpected(Abort): 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): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -222,7 +222,7 @@ def callcatch(ui, func): 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