From c5427a01272230b1b35afaa9764f77368fb7bfb8 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Tue, 4 Apr 2017 09:50:12 +0100 Subject: [PATCH] Fix display of errors while reading the key config file Also catch `cmdexc.CommandError` on startup to show these errors in the alert dialog on startup. Fixes #1340 --- qutebrowser/config/config.py | 3 ++- qutebrowser/config/parsers/keyconf.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 83e0e9c8f..1e0cec92b 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -186,7 +186,8 @@ def _init_key_config(parent): key_config = keyconf.KeyConfigParser(standarddir.config(), 'keys.conf', args.relaxed_config, parent=parent) - except (keyconf.KeyConfigError, UnicodeDecodeError) as e: + except (keyconf.KeyConfigError, cmdexc.CommandError, + UnicodeDecodeError) as e: log.init.exception(e) errstr = "Error while reading key config:\n" if e.lineno is not None: diff --git a/qutebrowser/config/parsers/keyconf.py b/qutebrowser/config/parsers/keyconf.py index d8aaa960e..2f0d8df69 100644 --- a/qutebrowser/config/parsers/keyconf.py +++ b/qutebrowser/config/parsers/keyconf.py @@ -322,7 +322,7 @@ class KeyConfigParser(QObject): else: line = line.strip() self._read_command(line) - except KeyConfigError as e: + except (KeyConfigError, cmdexc.CommandError) as e: if relaxed: continue else: