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)
|
self.config = ConfigManager(confdir, 'qutebrowser.conf', self)
|
||||||
except (config.ValidationError,
|
except (config.ValidationError,
|
||||||
config.NoOptionError,
|
config.NoOptionError,
|
||||||
|
config.InterpolationSyntaxError,
|
||||||
configparser.InterpolationError,
|
configparser.InterpolationError,
|
||||||
configparser.DuplicateSectionError,
|
configparser.DuplicateSectionError,
|
||||||
configparser.DuplicateOptionError,
|
configparser.DuplicateOptionError,
|
||||||
configparser.ParsingError,
|
configparser.ParsingError) as e:
|
||||||
ValueError) as e:
|
|
||||||
errstr = "Error while reading config:"
|
errstr = "Error while reading config:"
|
||||||
if hasattr(e, 'section') and hasattr(e, 'option'):
|
if hasattr(e, 'section') and hasattr(e, 'option'):
|
||||||
errstr += "\n\n{} -> {}:".format(e.section, e.option)
|
errstr += "\n\n{} -> {}:".format(e.section, e.option)
|
||||||
|
@ -71,6 +71,13 @@ class NoOptionError(configparser.NoOptionError):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class InterpolationSyntaxError(ValueError):
|
||||||
|
|
||||||
|
"""Exception raised when configparser interpolation raised an error."""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfigManager(QObject):
|
class ConfigManager(QObject):
|
||||||
|
|
||||||
"""Configuration manager for qutebrowser.
|
"""Configuration manager for qutebrowser.
|
||||||
@ -361,7 +368,11 @@ class ConfigManager(QObject):
|
|||||||
changed: If the config was changed.
|
changed: If the config was changed.
|
||||||
style_changed: When style caches need to be invalidated.
|
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:
|
try:
|
||||||
sect = self.sections[sectname]
|
sect = self.sections[sectname]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
Reference in New Issue
Block a user