diff mercurial/config.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 f23f87462c18
children 037d910734de
line wrap: on
line diff
--- a/mercurial/config.py	Fri Jun 04 20:19:53 2010 -0500
+++ b/mercurial/config.py	Fri Jun 04 20:57:26 2010 -0500
@@ -103,10 +103,10 @@
                     try:
                         include(inc, remap=remap, sections=sections)
                     except IOError, inst:
-                        msg = _("config error at %s:%d: "
-                                "cannot include %s (%s)") \
-                            % (src, line, inc, inst.strerror)
-                        raise error.ConfigError(msg)
+                        raise error.ParseError(
+                            _("cannot include %s (%s)")
+                            % (inc, inst.strerror),
+                            msg, "%s:%s" % (src, line))
                 continue
             if emptyre.match(l):
                 continue
@@ -135,8 +135,7 @@
                     del self._data[section][name]
                 continue
 
-            raise error.ConfigError(_("config error at %s:%d: '%s'")
-                                    % (src, line, l.rstrip()))
+            raise error.ParseError(l.rstrip(), ("%s:%s" % (src, line)))
 
     def read(self, path, fp=None, sections=None, remap=None):
         if not fp: