Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 45887:7eb221b9af6c
errors: make ParseError a subtype of Abort
I didn't plan this before, but the previous two changes made it really
easy to make `ParseError` a subtype of `Abort`. It seems obvious with
hindsight that I *should* have planned it :)
Differential Revision: https://phab.mercurial-scm.org/D9350
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 19 Nov 2020 15:13:39 -0800 |
parents | 600aec73f309 |
children | ca39c45014fa |
comparison
equal
deleted
inserted
replaced
45886:18489e26d9a0 | 45887:7eb221b9af6c |
---|---|
254 if req.ferr: | 254 if req.ferr: |
255 req.ui.ferr = req.ferr | 255 req.ui.ferr = req.ferr |
256 if req.fmsg: | 256 if req.fmsg: |
257 req.ui.fmsg = req.fmsg | 257 req.ui.fmsg = req.fmsg |
258 except error.Abort as inst: | 258 except error.Abort as inst: |
259 ferr.write(inst.format()) | |
260 return -1 | |
261 except error.ParseError as inst: | |
262 ferr.write(inst.format()) | 259 ferr.write(inst.format()) |
263 return -1 | 260 return -1 |
264 | 261 |
265 msg = _formatargs(req.args) | 262 msg = _formatargs(req.args) |
266 starttime = util.timer() | 263 starttime = util.timer() |
464 ui.warn(_(b"hg %s: %s\n") % (inst.command, msgbytes)) | 461 ui.warn(_(b"hg %s: %s\n") % (inst.command, msgbytes)) |
465 commands.help_(ui, inst.command, full=False, command=True) | 462 commands.help_(ui, inst.command, full=False, command=True) |
466 else: | 463 else: |
467 ui.warn(_(b"hg: %s\n") % inst.message) | 464 ui.warn(_(b"hg: %s\n") % inst.message) |
468 ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) | 465 ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) |
469 except error.ParseError as inst: | |
470 ui.warn(inst.format()) | |
471 return -1 | |
472 except error.UnknownCommand as inst: | 466 except error.UnknownCommand as inst: |
473 nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command | 467 nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command |
474 try: | 468 try: |
475 # check if the command is in a disabled extension | 469 # check if the command is in a disabled extension |
476 # (but don't check for extensions themselves) | 470 # (but don't check for extensions themselves) |