changeset 1876:2e0fd78587bd

Catch hgrc interpolation errors nicely.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 10 Mar 2006 11:34:02 +0100
parents 2f4a0734c100
children d314a89fa4f1
files mercurial/ui.py
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Mar 10 11:33:28 2006 +0100
+++ b/mercurial/ui.py	Fri Mar 10 11:34:02 2006 +0100
@@ -64,7 +64,10 @@
         if self.overlay.has_key((section, name)):
             return self.overlay[(section, name)]
         if self.cdata.has_option(section, name):
-            return self.cdata.get(section, name)
+            try:
+                return self.cdata.get(section, name)
+            except ConfigParser.InterpolationError, inst:
+                raise util.Abort(_("Error in configuration:\n%s") % inst)
         if self.parentui is None:
             return default
         else:
@@ -74,7 +77,10 @@
         if self.overlay.has_key((section, name)):
             return self.overlay[(section, name)]
         if self.cdata.has_option(section, name):
-            return self.cdata.getboolean(section, name)
+            try:
+                return self.cdata.getboolean(section, name)
+            except ConfigParser.InterpolationError, inst:
+                raise util.Abort(_("Error in configuration:\n%s") % inst)
         if self.parentui is None:
             return default
         else:
@@ -85,7 +91,10 @@
         if self.parentui is not None:
             items = dict(self.parentui.configitems(section))
         if self.cdata.has_section(section):
-            items.update(dict(self.cdata.items(section)))
+            try:
+                items.update(dict(self.cdata.items(section)))
+            except ConfigParser.InterpolationError, inst:
+                raise util.Abort(_("Error in configuration:\n%s") % inst)
         x = items.items()
         x.sort()
         return x