comparison mercurial/ui.py @ 4729:9881abfc0e44

Catch illegal boolean values in hgrc nicely. With hg 0.9.3 the section and parameter name wasn't printed, with hg 0.9.4 there was a traceback for ValueError.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 26 Jun 2007 20:37:15 +0200
parents 97369f6a6bb6
children ca0d02222d6a
comparison
equal deleted inserted replaced
4728:7bb5bcb089e3 4729:9881abfc0e44
235 cdata = self._get_cdata(untrusted) 235 cdata = self._get_cdata(untrusted)
236 if cdata.has_option(section, name): 236 if cdata.has_option(section, name):
237 try: 237 try:
238 func = getattr(cdata, funcname) 238 func = getattr(cdata, funcname)
239 return func(section, name) 239 return func(section, name)
240 except ConfigParser.InterpolationError, inst: 240 except (ConfigParser.InterpolationError, ValueError), inst:
241 msg = _("Error in configuration section [%s] " 241 msg = _("Error in configuration section [%s] "
242 "parameter '%s':\n%s") % (section, name, inst) 242 "parameter '%s':\n%s") % (section, name, inst)
243 if abort: 243 if abort:
244 raise util.Abort(msg) 244 raise util.Abort(msg)
245 self.warn(_("Ignored: %s\n") % msg) 245 self.warn(_("Ignored: %s\n") % msg)