Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 45827:8d72e29ad1e0
errors: introduce InputError and use it from commands and cmdutil
This patch introduces a `InputError` class and replaces many uses of
`error.Abort` by it in `commands` and `cmdutil`. This is a part of
https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. There will
later be a different class for state errors (to raise e.g. when
there's an unfinished operation). It's not always clear when one
should report an input error and when it should be a state error. We
can always adjust later if I got something wrong in this patch (but
feel free to point out any you notice now).
Differential Revision: https://phab.mercurial-scm.org/D9167
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 06 Oct 2020 22:36:15 -0700 |
parents | 21733e8c924f |
children | e0dbfbd4062c |
comparison
equal
deleted
inserted
replaced
45826:21733e8c924f | 45827:8d72e29ad1e0 |
---|---|
217 detailed_exit_code = 240 | 217 detailed_exit_code = 240 |
218 coarse_exit_code = 1 | 218 coarse_exit_code = 1 |
219 except error.WdirUnsupported: | 219 except error.WdirUnsupported: |
220 ui.error(_(b"abort: working directory revision cannot be specified\n")) | 220 ui.error(_(b"abort: working directory revision cannot be specified\n")) |
221 except error.Abort as inst: | 221 except error.Abort as inst: |
222 if isinstance(inst, error.InputError): | |
223 detailed_exit_code = 10 | |
222 ui.error(_(b"abort: %s\n") % inst.message) | 224 ui.error(_(b"abort: %s\n") % inst.message) |
223 if inst.hint: | 225 if inst.hint: |
224 ui.error(_(b"(%s)\n") % inst.hint) | 226 ui.error(_(b"(%s)\n") % inst.hint) |
225 except error.WorkerError as inst: | 227 except error.WorkerError as inst: |
226 # Don't print a message -- the worker already should have | 228 # Don't print a message -- the worker already should have |