Mercurial > hg
diff mercurial/chgserver.py @ 47289:33c0c25d0b0f
errors: let each Abort subclass define its error code
It's more flexible to have the error codes defined on the error types
themselves. That way extensions can easily set their own exit code. It
also means that we can reduce a bit of duplication betwen
`scmutil.callcatch()` and `chgserver.chgcmdserver.validate()`.
Differential Revision: https://phab.mercurial-scm.org/D10735
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 18 May 2021 17:15:49 -0700 |
parents | 6383bb86b700 |
children | 7a769ac49637 |
line wrap: on
line diff
--- a/mercurial/chgserver.py Wed May 19 15:10:49 2021 +0200 +++ b/mercurial/chgserver.py Tue May 18 17:15:49 2021 -0700 @@ -516,10 +516,8 @@ self.ui.error(_(b"(%s)\n") % inst.hint) errorraised = True except error.Abort as inst: - if isinstance(inst, error.InputError): - detailed_exit_code = 10 - elif isinstance(inst, error.ConfigError): - detailed_exit_code = 30 + if inst.detailed_exit_code is not None: + detailed_exit_code = inst.detailed_exit_code self.ui.error(inst.format()) errorraised = True