summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-16 17:56:46 +0900
committerGitHub <noreply@github.com>2020-02-16 17:56:46 +0900
commitbe608ca2313fc08eb842f3dc19d0f5d2d8227d08 (patch)
treeb71bc064c21d6cc2a5fd050ef53e27a8e475c390
parentb4b971c76f832ccf0b27d9b3be4e2b00bd0a5624 (diff)
parentda64e5bdfaa4d59291b5c061baa341489f20f535 (diff)
downloadsphinx-git-be608ca2313fc08eb842f3dc19d0f5d2d8227d08.tar.gz
Merge pull request #7123 from tk0miya/7108_ConfigError_in_conf.py
Close #7108: Allow to show an error message from conf.py via ConfigError
-rw-r--r--CHANGES1
-rw-r--r--sphinx/config.py3
2 files changed, 4 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 92dc4637e..83b1963e2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -49,6 +49,7 @@ Features added
* #3077: Implement the scoping for :rst:dir:`productionlist` as indicated
in the documentation.
* #1027: Support backslash line continuation in :rst:dir:`productionlist`.
+* #7108: config: Allow to show an error message from conf.py via ``ConfigError``
Bugs fixed
----------
diff --git a/sphinx/config.py b/sphinx/config.py
index ca99fd5b7..87007c33d 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -324,6 +324,9 @@ def eval_config_file(filename: str, tags: Tags) -> Dict[str, Any]:
msg = __("The configuration file (or one of the modules it imports) "
"called sys.exit()")
raise ConfigError(msg)
+ except ConfigError:
+ # pass through ConfigError from conf.py as is. It will be shown in console.
+ raise
except Exception:
msg = __("There is a programmable error in your configuration file:\n\n%s")
raise ConfigError(msg % traceback.format_exc())