Show More
@@ -103,10 +103,10 b' class config(object):' | |||
|
103 | 103 | try: |
|
104 | 104 | include(inc, remap=remap, sections=sections) |
|
105 | 105 | except IOError, inst: |
|
106 |
|
|
|
107 |
|
|
|
108 |
% ( |
|
|
109 | raise error.ConfigError(msg) | |
|
106 | raise error.ParseError( | |
|
107 | _("cannot include %s (%s)") | |
|
108 | % (inc, inst.strerror), | |
|
109 | msg, "%s:%s" % (src, line)) | |
|
110 | 110 | continue |
|
111 | 111 | if emptyre.match(l): |
|
112 | 112 | continue |
@@ -135,8 +135,7 b' class config(object):' | |||
|
135 | 135 | del self._data[section][name] |
|
136 | 136 | continue |
|
137 | 137 | |
|
138 | raise error.ConfigError(_("config error at %s:%d: '%s'") | |
|
139 | % (src, line, l.rstrip())) | |
|
138 | raise error.ParseError(l.rstrip(), ("%s:%s" % (src, line))) | |
|
140 | 139 | |
|
141 | 140 | def read(self, path, fp=None, sections=None, remap=None): |
|
142 | 141 | if not fp: |
@@ -24,8 +24,12 b' def dispatch(args):' | |||
|
24 | 24 | except util.Abort, inst: |
|
25 | 25 | sys.stderr.write(_("abort: %s\n") % inst) |
|
26 | 26 | return -1 |
|
27 |
except error. |
|
|
28 | sys.stderr.write(_("hg: %s\n") % inst) | |
|
27 | except error.ParseError, 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 | 33 | return -1 |
|
30 | 34 | return _runcatch(u, args) |
|
31 | 35 | |
@@ -62,8 +66,13 b' def _runcatch(ui, args):' | |||
|
62 | 66 | except error.AmbiguousCommand, inst: |
|
63 | 67 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
64 | 68 | (inst.args[0], " ".join(inst.args[1]))) |
|
65 |
except error. |
|
|
66 | ui.warn(_("hg: %s\n") % inst.args[0]) | |
|
69 | except error.ParseError, inst: | |
|
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 | 76 | except error.LockHeld, inst: |
|
68 | 77 | if inst.errno == errno.ETIMEDOUT: |
|
69 | 78 | reason = _('timed out waiting for lock held by %s') % inst.locker |
@@ -30,9 +30,15 b' class LookupError(RevlogError, KeyError)' | |||
|
30 | 30 | class CommandError(Exception): |
|
31 | 31 | """Exception raised on errors in parsing the command line.""" |
|
32 | 32 | |
|
33 |
class |
|
|
33 | class Abort(Exception): | |
|
34 | """Raised if a command needs to print an error and exit.""" | |
|
35 | ||
|
36 | class ConfigError(Abort): | |
|
34 | 37 | 'Exception raised when parsing config files' |
|
35 | 38 | |
|
39 | class ParseError(Abort): | |
|
40 | 'Exception raised when parsing config files (msg[, pos])' | |
|
41 | ||
|
36 | 42 | class RepoError(Exception): |
|
37 | 43 | pass |
|
38 | 44 | |
@@ -70,6 +76,3 b' class SignalInterrupt(KeyboardInterrupt)' | |||
|
70 | 76 | |
|
71 | 77 | class SignatureError(Exception): |
|
72 | 78 | pass |
|
73 | ||
|
74 | class Abort(Exception): | |
|
75 | """Raised if a command needs to print an error and exit.""" |
General Comments 0
You need to be logged in to leave comments.
Login now