Don't catch every ValueError to get failed interpolations
This commit is contained in:
parent
f0c67193a9
commit
0705d6087c
@ -180,11 +180,11 @@ class Application(QApplication):
|
||||
self.config = ConfigManager(confdir, 'qutebrowser.conf', self)
|
||||
except (config.ValidationError,
|
||||
config.NoOptionError,
|
||||
config.InterpolationSyntaxError,
|
||||
configparser.InterpolationError,
|
||||
configparser.DuplicateSectionError,
|
||||
configparser.DuplicateOptionError,
|
||||
configparser.ParsingError,
|
||||
ValueError) as e:
|
||||
configparser.ParsingError) as e:
|
||||
errstr = "Error while reading config:"
|
||||
if hasattr(e, 'section') and hasattr(e, 'option'):
|
||||
errstr += "\n\n{} -> {}:".format(e.section, e.option)
|
||||
|
@ -71,6 +71,13 @@ class NoOptionError(configparser.NoOptionError):
|
||||
pass
|
||||
|
||||
|
||||
class InterpolationSyntaxError(ValueError):
|
||||
|
||||
"""Exception raised when configparser interpolation raised an error."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ConfigManager(QObject):
|
||||
|
||||
"""Configuration manager for qutebrowser.
|
||||
@ -361,7 +368,11 @@ class ConfigManager(QObject):
|
||||
changed: If the config was changed.
|
||||
style_changed: When style caches need to be invalidated.
|
||||
"""
|
||||
value = self._interpolation.before_set(self, sectname, optname, value)
|
||||
try:
|
||||
value = self._interpolation.before_set(self, sectname, optname,
|
||||
value)
|
||||
except ValueError as e:
|
||||
raise InterpolationSyntaxError(e)
|
||||
try:
|
||||
sect = self.sections[sectname]
|
||||
except KeyError:
|
||||
|
Loading…
Reference in New Issue
Block a user