diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 8e18b3adc..bb93a6706 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -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) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 84bfac3e7..f92acb134 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -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: