Catch configparser exceptions on start
This commit is contained in:
parent
46cf62ab34
commit
c9a25d6309
3
TODO
3
TODO
@ -6,9 +6,6 @@ Weird font rendering
|
||||
https://bugreports.qt-project.org/browse/QTBUG-20973
|
||||
https://bugreports.qt-project.org/browse/QTBUG-21036
|
||||
Changing completion models is awfully slow
|
||||
new keybinding (not in config) crashes exception handler
|
||||
Also, what about unknown settings, unknown values, wrong interpolations,
|
||||
etc.?
|
||||
values written to config are unordered
|
||||
values starting with ; need to be escaped
|
||||
|
||||
|
@ -108,12 +108,17 @@ class QuteBrowser(QApplication):
|
||||
confdir = self._args.confdir
|
||||
try:
|
||||
config.init(confdir)
|
||||
except config.ValidationError as e:
|
||||
msgbox = QMessageBox(
|
||||
QMessageBox.Critical,
|
||||
"Error while reading config!",
|
||||
"Error while reading config:\n\n{} -> {}:\n{}".format(
|
||||
e.section, e.option, e))
|
||||
except (config.ValidationError,
|
||||
configparser.InterpolationError,
|
||||
configparser.DuplicateSectionError,
|
||||
configparser.DuplicateOptionError,
|
||||
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)
|
||||
errstr += "\n{}".format(e)
|
||||
msgbox = QMessageBox(QMessageBox.Critical,
|
||||
"Error while reading config!", errstr)
|
||||
msgbox.exec_()
|
||||
# We didn't really initialize much so far, so we just quit hard.
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user