Error if unknown sections are in the config.
This commit is contained in:
parent
a796482c83
commit
ab0e600977
@ -176,6 +176,8 @@ class Application(QApplication):
|
||||
self)
|
||||
except (configtypes.ValidationError,
|
||||
config.NoOptionError,
|
||||
config.NoSectionError,
|
||||
config.UnknownSectionError,
|
||||
config.InterpolationSyntaxError,
|
||||
configparser.InterpolationError,
|
||||
configparser.DuplicateSectionError,
|
||||
|
@ -75,6 +75,13 @@ class InterpolationSyntaxError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
class UnknownSectionError(Exception):
|
||||
|
||||
"""Exception raised when there was an unknwon section in the config."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ConfigManager(QObject):
|
||||
|
||||
"""Configuration manager for qutebrowser.
|
||||
@ -203,7 +210,11 @@ class ConfigManager(QObject):
|
||||
Args:
|
||||
cp: The configparser instance to read the values from.
|
||||
"""
|
||||
for sectname in self.sections.keys():
|
||||
for sectname in cp:
|
||||
if sectname is not 'DEFAULT' and sectname not in self.sections:
|
||||
raise UnknownSectionError("Unknown section '{}'!".format(
|
||||
sectname))
|
||||
for sectname in self.sections:
|
||||
if sectname not in cp:
|
||||
continue
|
||||
for k, v in cp[sectname].items():
|
||||
|
Loading…
Reference in New Issue
Block a user