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)
|
self)
|
||||||
except (configtypes.ValidationError,
|
except (configtypes.ValidationError,
|
||||||
config.NoOptionError,
|
config.NoOptionError,
|
||||||
|
config.NoSectionError,
|
||||||
|
config.UnknownSectionError,
|
||||||
config.InterpolationSyntaxError,
|
config.InterpolationSyntaxError,
|
||||||
configparser.InterpolationError,
|
configparser.InterpolationError,
|
||||||
configparser.DuplicateSectionError,
|
configparser.DuplicateSectionError,
|
||||||
|
@ -75,6 +75,13 @@ class InterpolationSyntaxError(ValueError):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownSectionError(Exception):
|
||||||
|
|
||||||
|
"""Exception raised when there was an unknwon section in the config."""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfigManager(QObject):
|
class ConfigManager(QObject):
|
||||||
|
|
||||||
"""Configuration manager for qutebrowser.
|
"""Configuration manager for qutebrowser.
|
||||||
@ -203,7 +210,11 @@ class ConfigManager(QObject):
|
|||||||
Args:
|
Args:
|
||||||
cp: The configparser instance to read the values from.
|
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:
|
if sectname not in cp:
|
||||||
continue
|
continue
|
||||||
for k, v in cp[sectname].items():
|
for k, v in cp[sectname].items():
|
||||||
|
Loading…
Reference in New Issue
Block a user