Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 11288:2123aad24d56
error: add new ParseError for various parsing errors
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 04 Jun 2010 20:57:26 -0500 |
parents | b901bb751999 |
children | d4cafcb63f77 |
comparison
equal
deleted
inserted
replaced
11287:b901bb751999 | 11288:2123aad24d56 |
---|---|
22 if '--traceback' in args: | 22 if '--traceback' in args: |
23 u.setconfig('ui', 'traceback', 'on') | 23 u.setconfig('ui', 'traceback', 'on') |
24 except util.Abort, inst: | 24 except util.Abort, inst: |
25 sys.stderr.write(_("abort: %s\n") % inst) | 25 sys.stderr.write(_("abort: %s\n") % inst) |
26 return -1 | 26 return -1 |
27 except error.ConfigError, inst: | 27 except error.ParseError, inst: |
28 sys.stderr.write(_("hg: %s\n") % inst) | 28 if len(inst.args) > 1: |
29 sys.stderr.write(_("hg: parse error at %s: %s\n") % | |
30 (inst.args[1], inst.args[0])) | |
31 else: | |
32 sys.stderr.write(_("hg: parse error: %s\n") % ints.args[0]) | |
29 return -1 | 33 return -1 |
30 return _runcatch(u, args) | 34 return _runcatch(u, args) |
31 | 35 |
32 def _runcatch(ui, args): | 36 def _runcatch(ui, args): |
33 def catchterm(*args): | 37 def catchterm(*args): |
60 # Global exception handling, alphabetically | 64 # Global exception handling, alphabetically |
61 # Mercurial-specific first, followed by built-in and library exceptions | 65 # Mercurial-specific first, followed by built-in and library exceptions |
62 except error.AmbiguousCommand, inst: | 66 except error.AmbiguousCommand, inst: |
63 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % | 67 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
64 (inst.args[0], " ".join(inst.args[1]))) | 68 (inst.args[0], " ".join(inst.args[1]))) |
65 except error.ConfigError, inst: | 69 except error.ParseError, inst: |
66 ui.warn(_("hg: %s\n") % inst.args[0]) | 70 if len(inst.args) > 1: |
71 ui.warn(_("hg: parse error at %s: %s\n") % | |
72 (inst.args[1], inst.args[0])) | |
73 else: | |
74 ui.warn(_("hg: parse error: %s\n") % inst.args[0]) | |
75 return -1 | |
67 except error.LockHeld, inst: | 76 except error.LockHeld, inst: |
68 if inst.errno == errno.ETIMEDOUT: | 77 if inst.errno == errno.ETIMEDOUT: |
69 reason = _('timed out waiting for lock held by %s') % inst.locker | 78 reason = _('timed out waiting for lock held by %s') % inst.locker |
70 else: | 79 else: |
71 reason = _('lock held by %s') % inst.locker | 80 reason = _('lock held by %s') % inst.locker |