Show More
@@ -103,10 +103,10 b' class config(object):' | |||||
103 | try: |
|
103 | try: | |
104 | include(inc, remap=remap, sections=sections) |
|
104 | include(inc, remap=remap, sections=sections) | |
105 | except IOError, inst: |
|
105 | except IOError, inst: | |
106 |
|
|
106 | raise error.ParseError( | |
107 |
|
|
107 | _("cannot include %s (%s)") | |
108 |
% ( |
|
108 | % (inc, inst.strerror), | |
109 | raise error.ConfigError(msg) |
|
109 | msg, "%s:%s" % (src, line)) | |
110 | continue |
|
110 | continue | |
111 | if emptyre.match(l): |
|
111 | if emptyre.match(l): | |
112 | continue |
|
112 | continue | |
@@ -135,8 +135,7 b' class config(object):' | |||||
135 | del self._data[section][name] |
|
135 | del self._data[section][name] | |
136 | continue |
|
136 | continue | |
137 |
|
137 | |||
138 | raise error.ConfigError(_("config error at %s:%d: '%s'") |
|
138 | raise error.ParseError(l.rstrip(), ("%s:%s" % (src, line))) | |
139 | % (src, line, l.rstrip())) |
|
|||
140 |
|
139 | |||
141 | def read(self, path, fp=None, sections=None, remap=None): |
|
140 | def read(self, path, fp=None, sections=None, remap=None): | |
142 | if not fp: |
|
141 | if not fp: |
@@ -24,8 +24,12 b' def dispatch(args):' | |||||
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. |
|
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 | |||
@@ -62,8 +66,13 b' def _runcatch(ui, args):' | |||||
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. |
|
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 |
@@ -30,9 +30,15 b' class LookupError(RevlogError, KeyError)' | |||||
30 | class CommandError(Exception): |
|
30 | class CommandError(Exception): | |
31 | """Exception raised on errors in parsing the command line.""" |
|
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 | 'Exception raised when parsing config files' |
|
37 | 'Exception raised when parsing config files' | |
35 |
|
38 | |||
|
39 | class ParseError(Abort): | |||
|
40 | 'Exception raised when parsing config files (msg[, pos])' | |||
|
41 | ||||
36 | class RepoError(Exception): |
|
42 | class RepoError(Exception): | |
37 | pass |
|
43 | pass | |
38 |
|
44 | |||
@@ -70,6 +76,3 b' class SignalInterrupt(KeyboardInterrupt)' | |||||
70 |
|
76 | |||
71 | class SignatureError(Exception): |
|
77 | class SignatureError(Exception): | |
72 | pass |
|
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