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-20973
|
||||||
https://bugreports.qt-project.org/browse/QTBUG-21036
|
https://bugreports.qt-project.org/browse/QTBUG-21036
|
||||||
Changing completion models is awfully slow
|
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 written to config are unordered
|
||||||
values starting with ; need to be escaped
|
values starting with ; need to be escaped
|
||||||
|
|
||||||
|
@ -108,12 +108,17 @@ class QuteBrowser(QApplication):
|
|||||||
confdir = self._args.confdir
|
confdir = self._args.confdir
|
||||||
try:
|
try:
|
||||||
config.init(confdir)
|
config.init(confdir)
|
||||||
except config.ValidationError as e:
|
except (config.ValidationError,
|
||||||
msgbox = QMessageBox(
|
configparser.InterpolationError,
|
||||||
QMessageBox.Critical,
|
configparser.DuplicateSectionError,
|
||||||
"Error while reading config!",
|
configparser.DuplicateOptionError,
|
||||||
"Error while reading config:\n\n{} -> {}:\n{}".format(
|
configparser.ParsingError) as e:
|
||||||
e.section, e.option, 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_()
|
msgbox.exec_()
|
||||||
# We didn't really initialize much so far, so we just quit hard.
|
# We didn't really initialize much so far, so we just quit hard.
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user