From b59a7cdcc0e0b7f961867a0d705aaa1c9b22f4c2 Mon Sep 17 00:00:00 2001 From: George Edward Bulmer Date: Mon, 12 Feb 2018 14:07:05 +0000 Subject: [PATCH] Report syntax errors as unhandled exceptions Update tests accordingly --- qutebrowser/config/configfiles.py | 2 +- tests/unit/config/test_configfiles.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/config/configfiles.py b/qutebrowser/config/configfiles.py index 692474075..3dccc129f 100644 --- a/qutebrowser/config/configfiles.py +++ b/qutebrowser/config/configfiles.py @@ -419,7 +419,7 @@ def read_config_py(filename, raising=False): desc = configexc.ConfigErrorDesc("Error while compiling", e) raise configexc.ConfigFileErrors(basename, [desc]) except SyntaxError as e: - desc = configexc.ConfigErrorDesc("Syntax Error", e, + desc = configexc.ConfigErrorDesc("Unhandled exception", e, traceback=traceback.format_exc()) raise configexc.ConfigFileErrors(basename, [desc]) diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index 341fad689..06633ffc7 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -550,7 +550,7 @@ class TestConfigPy: assert len(excinfo.value.errors) == 1 error = excinfo.value.errors[0] assert isinstance(error.exception, SyntaxError) - assert error.text == "Syntax Error" + assert error.text == "Unhandled exception" exception_text = 'invalid syntax (config.py, line 1)' assert str(error.exception) == exception_text